Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Prototype pollution risk in snaps controllers setState handling possible __proto__ assignment #3718

Open
@ptrgits

Description

There appears to be a prototype-pollution source in the snaps codebase where user-controlled keys may be assigned directly into objects/state without filtering or sanitization. The vulnerable code paths are in the SnapController and the setState RPC handler. An attacker controlling a key such as __proto__ can modify Object.prototype and thus influence many objects across the runtime.

accumulator[assets.asset] ??= {};
accumulator[assets.asset][assets.unit] = result;
}
return accumulator;
}, {});

Record<CaipAssetType, Record<CaipAssetType, AssetConversion>>
>((accumulator, conversion) => {
const rate = conversionRates[conversion.from]?.[conversion.to];
// Only include rates that were actually requested.
if (rate) {
accumulator[conversion.from] ??= {};
accumulator[conversion.from][conversion.to] = rate;

if (FORBIDDEN_KEYS.includes(currentKey)) {
throw rpcErrors.invalidParams(
'Invalid params: Key contains forbidden characters.',

Prototype pollution allows to add or modify properties on Object.prototype. Because most objects inherit from Object.prototype, those newly added properties can change application logic, enable gadget chains, or lead to client-side XSS or server-side RCE in some contexts. and then merges/assigns state into an internal object without sanitizing keys, the __proto__ setter will pollute Object.prototype so every object {} .isAdmin === true which can be abused if later code checks obj.isAdmin before privileged operations.

References Prototype pollution

lodash
jQuery
extend
just-extend
merge.recursive.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /