Prototype Pollution in network.model.ts
hello. This is LY Security Assessment Team. Share the security vulnerabilities we found.
vConsole Version: 3.16.0-alpha(de7026df97148799c3efcd29577e3eda0788362f)
issue
Possible prototype pollution due to missing id validation in updateRequest in network.model.ts.
updateRequest resolves reqList[id] without validating the id parameter. When id is "__proto__", reqList["__proto__"] returns Object.prototype (via the __proto__ accessor on plain objects), and !!Object.prototype evaluates to true. The subsequent for..in loop then writes all enumerable properties of data directly onto Object.prototype, resulting in global prototype pollution.
This is reachable through two public APIs:
vConsole.network.update(id, item)innetwork.exporter.ts— passesiddirectly toupdateRequestvConsole.network.add(item)innetwork.exporter.ts— copiesitem.idonto the internal proxy viafor..in, then passes it toupdateRequest
Note: setOption() was previously patched for the same class of vulnerability by adding __proto__ / constructor / prototype key checks (core.ts#L518-L521), but the same mitigation was not applied to updateRequest.
poc
// Vector 1: precise injection via update()
vConsole.network.update('__proto__', { polluted: 'pwned' });
console.log({}.polluted); // "pwned"
// Vector 2: mass pollution via add()
vConsole.network.add({ id: '__proto__', url: 'http://example.com', method: 'GET', status: 200 });
console.log({}.url); // "http://example.com/"
console.log({}.status); // 200
console.log({}.method); // "GET"Source: Tencent/vConsole