Summary
brikcss merge up to version 1.3.0 is vulnerable to a prototype pollution issue via specially crafted arguments such as __proto__, constructor.prototype, or prototype, allowing modification of base object attributes.
In JavaScript environments where polluted prototypes influence application logic, this can escalate to arbitrary code execution or other unexpected behavior when trusted objects are later used.
Affected context
The vulnerability affects applications that import and use the brikcss merge utility (≤ 1.3.0) to merge user-controlled or otherwise untrusted objects into application state.
It is particularly relevant in Node.js or browser-based code where:
- Application logic iterates over or trusts object properties created via merging
- Frameworks, configuration loaders, or templating systems rely on plain objects that may inherit from
Object.prototype - Security assumptions are made about which properties can exist on request, configuration, or model objects
The vulnerability does not manifest unless the library is used on data that an attacker can influence.
Exploit preconditions
- Attack surface: Any API endpoint, CLI interface, or browser code path that passes attacker-controlled objects into
brikcss merge. - Required access: Ability to supply JSON-like data, query/body parameters, or configuration values that are merged (remote network access is sufficient in many web scenarios).
- Trigger point: Invocation of
mergewith an object containing keys like__proto__,constructor.prototype, orprototype. - Why exploitation is possible: The merge logic does not filter or block special prototype-related keys, allowing writes to
Object.prototypeor other shared prototypes. Subsequent object instantiation or property access then operates on a polluted prototype chain.
Why this happens
This issue stems from an unsafe object merge implementation that fails to treat prototype-related properties as sensitive.
When merging arbitrary objects, keys such as __proto__, constructor, or nested constructor.prototype are treated like normal properties and are recursively assigned.
This maps to CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where attacker input can mutate the prototypes of core objects.
In environments that later evaluate or execute data derived from these polluted objects (e.g., building dynamic function strings or injecting into template engines), the problem can align with CWE-94: Code Injection, as modified prototypes may influence control flow or introduce executable payloads.
Potential impact
- Global modification of
Object.prototypeor other shared prototypes across the process - Bypassing security checks that depend on checking own-properties or whitelisting object keys
- Alteration of application logic, leading to privilege escalation or authorization bypass
- Injection of unexpected values into logging, templating, or configuration subsystems
- Under certain application-specific conditions, escalation to arbitrary code execution
General mitigation guidance
Defenses typically focus on hardening merge utilities and reducing trust in object structure:
- Treat prototype-related keys (
__proto__,prototype,constructor,constructor.prototype, etc.) as reserved and block or drop them before merging. - Prefer safe, well-reviewed deep-merge utilities that explicitly guard against prototype pollution.
- Constrain where and how untrusted data is merged; favor explicit mapping of input fields to known schema-backed objects over generic deep merges.
- Use objects without a prototype (e.g.,
Object.create(null)orMap) for structures derived from untrusted input to limit damage if pollution occurs. - Apply least-privilege design to critical objects and configuration structures so that polluted properties are less likely to affect sensitive behavior.
How teams detect issues like this
Detection can combine static analysis, code review, and runtime monitoring:
- Static analysis / SAST: Flag use of deep-merge helpers where untrusted input flows directly into generic merge calls without filtering prototype-related keys.
- Code review signals: Look for calls to
merge(or similar utilities) with request bodies, query parameters, or deserialized JSON, especially when merging into global configuration or shared state. - Policy enforcement: Establish secure coding guidelines that forbid merging unvalidated user input into application-wide objects and require schema-based validation.
- Runtime monitoring: In Node.js environments, monitor for unexpected properties appearing on
Object.prototypeor other core prototypes as an indicator of potential pollution.

