Skip to content

fix(feat): Prototype Pollution Vulnerability in Mozilla FxA Account Management #18820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

odaysec
Copy link
Contributor

@odaysec odaysec commented May 6, 2025

legacyLocalStorageAccount.metricsEnabled = state === 'in';

fix the issue need to prevent prototype pollution by ensuring that user-controlled keys cannot include dangerous values like __proto__, constructor, or prototype. This can be achieved by validating or sanitizing the keys before they are used in the accounts object. Specifically:

  1. Modify the currentAccount() function in packages/fxa-settings/src/lib/cache.ts to validate the forceUid and account.uid keys before using them.
  2. Reject or sanitize any keys that could lead to prototype pollution.

References

Object.prototype.proto
Map
CWE-78
CWE-79
CWE-94
CWE-400
CWE-471
CWE-915

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

@odaysec odaysec requested a review from a team as a code owner May 6, 2025 17:47
@chenba
Copy link
Contributor

chenba commented May 8, 2025

@odaysec this PR includes the changes from #18812, which is causing failures in our CI. Please fix the earlier changes or remove them from this PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants