Closed Bug 1783267 Opened 2 years ago Closed 2 years ago

External authentication prompt injection via unsafe remote file include at https://ctms.prod.mozilla-ess.mozit.cloud/docs

Categories

(Websites :: Other, task)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: todayisnew, Unassigned)

References

()

Details

(Keywords: reporter-external, sec-high, wsec-authentication, Whiteboard: [reporter-external] [web-bounty-form] [verif?])

Attachments

(1 file)

Good day, I truly hope it treats you great on your side of the screen :)

I have found that your have a site which is vulnerable to a remote file include to an arbitrary host - in this case, I am able to load my own content from todayisnewpoc.surge.sh.

There is sanitization of the data being loaded from todayisnewpoc.surge.sh, which can prevent some common attack vectors/know payloads, but I am still able to inject a custom authentication prompt which loads when visiting the page.

This prompt is being served from an arbitrary location (authorization.site), which can be modified as needed to be as convincing as possible to any possible victim. Imagine yourdomain.authorization.site, for example. Depending on the browser being used, a message can be included along with the prompt to make it seem more trustworthy.

When a victim enters their information into the prompt, it is sent to the arbitrary location being used by the attacker (authorization.site) along with their IP address, and stored in plain text for the attacker to use when desired.

Additionally, if the victim closes the first prompt, an attacker can serve arbitrary text on the page to encourage them to authorize. If they do so by clicking on the Authorize button, then clicking on the subsequent Authorize button, the victim will again be shown my external authentication prompt from authorization.site

POC:

https://ctms.prod.mozilla-ess.mozit.cloud/docs?url=https://todayisnewpoc.surge.sh/auth2.yaml

How to fix: Restrict the ability to load external json/yaml files via the configUrl and url parameters, or implement an allowed-list for domains which can load via these parameters.

May you be well on your side of the screen :)

-Eric

Flags: sec-bounty?
See Also: → 1783266

This appears to be caused by us using an outdated version of FastAPI.

I was able to reproduce the bug by:

  • pip installing fastapi== 0.74.1 (version currently used in CTMS) and uvicorn
  • making a minimal FastAPI app:
from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def root():
    return {"message": "Hello World"}
  • starting the app
uvicorn main:app 
  • navigating to http://127.0.0.1:8000/docs?url=https://todayisnewpoc.surge.sh/auth2.yaml

After pip installing fastapi== 0.79.0 though, the url param seems to be ignored and no authorization popup appears.

Status: UNCONFIRMED → NEW
Ever confirmed: true

The URL provided in the POC no longer triggers the authorization popup after releasing v1.8.1

https://ctms.prod.mozilla-ess.mozit.cloud/docs?url=https://todayisnewpoc.surge.sh/auth2.yaml

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Attached image ctms-prod-ui.png

Adding a screenshot of some part of the flow

The reason this fastapi upgrade fixed the issue is that in fastapi version 0.75.2 a change is added which upgrades swagger-ui from version 3.52.5 to 4.1.3.

This upgrade to swagger-ui includes this fix which mitigates CVE-2021-46708 which this bug is reporting.

Note from the issue in swagger-ui, https://github.com/swagger-api/swagger-ui/issues/4872, which explains the attack reported in this bug:

Additionally, the URL parameter is dangerous in general because it allows an attacker to provide a similar schema file that instead sends authorization requests to a server under an attacker’s control, which makes it much easier to trick a user into leaking their login credentials. So the URL parameter should not be allowed in any setting where authentication or other sensitive information is used. I’d recommend disabling it by default and cautioning users against enabling it.

Flags: sec-bounty? → sec-bounty+

todayisnew, thanks very much for the report. Tom will follow up with you to coordinate payment for the bounty award.

Group: websites-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: