うつろい EC のユーザ設定 API は、ユーザ送信の JSON を内部設定オブジェクトに「再帰的にマージ」する実装。マージ関数は __proto__ キーを除外していない、典型的な脆弱パターン。
function deepMerge(target, source) {
for (const key in source) {
if (typeof source[key] === 'object' && source[key] !== null) {
target[key] = target[key] || {};
deepMerge(target[key], source[key]);
} else {
target[key] = source[key];
}
}
}
権限チェックは if (currentUser.isAdmin) { ... }。Object.prototype を汚染できれば、すべてのユーザが isAdmin=true として判定される。