Headline
CVE-2022-25862: sds/set.js at master · monsterkodi/sds
This affects the package sds from 0.0.0. The library could be tricked into adding or modifying properties of the Object.prototype by abusing the set function located in js/set.js.
Note: This vulnerability derives from an incomplete fix to CVE-2020-7618
// koffee 1.14.0
/*
0000000 00000000 000000000
000 000 000
0000000 0000000 000
000 000 000
0000000 00000000 000
*/
var set,
indexOf = [].indexOf;
set = function(object, keypath, value) {
var k, kp, o;
if (typeof keypath === ‘string’) {
keypath = keypath.split(‘.’);
}
if (!(keypath instanceof Array)) {
throw "invalid keypath: " + (JSON.stringify(keypath));
}
kp = [].concat(keypath);
if (indexOf.call(keypath, ‘__proto__’) >= 0) {
throw "__proto__ in keypath: " + (JSON.stringify(keypath));
}
o = object;
while (kp.length > 1) {
k = kp.shift();
if (o[k] == null) {
if (!Number.isNaN(parseInt(k))) {
o = o[k] = [];
} else {
o = o[k] = {};
}
} else {
o = o[k];
}
}
if (kp.length === 1 && (o != null)) {
if (value === void 0) {
delete o[kp[0]];
} else {
o[kp[0]] = value;
if (o[kp[0]] !== value) {
throw "couldn’t set value " + (JSON.stringify(value)) + " for keypath " + (keypath.join(‘.’)) + " in " + (JSON.stringify(object));
}
}
}
return object;
};
module.exports = set;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0LmpzIiwic291cmNlUm9vdCI6Ii4uL2NvZmZlZSIsInNvdXJjZXMiOlsic2V0LmNvZmZlZSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7O0FBQUEsSUFBQSxHQUFBO0lBQUE7O0FBV0EsR0FBQSxHQUFNLFNBQUMsTUFBRCxFQUFTLE9BQVQsRUFBa0IsS0FBbEI7QUFFRixRQUFBO0lBQUEsSUFBK0IsT0FBTyxPQUFQLEtBQW1CLFFBQWxEO1FBQUEsT0FBQSxHQUFVLE9BQU8sQ0FBQyxLQUFSLENBQWMsR0FBZCxFQUFWOztJQUNBLElBQXNELENBQUksQ0FBQ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ugc2VjdXJpdHkgYm90cyBoYXBweSAuLi5cbiAgICAgICAgdGhyb3cgXCJfX3Byb3RvX18gaW4ga2V5cGF0aDogI3tKU09OLnN0cmluZ2lmeSBrZXlwYXRofVwiXG4gICAgXG4gICAgbyA9IG9iamVjdFxuICAgICAgICBcbiAgICB3aGlsZSBrcC5sZW5ndGggPiAxXG4gICAgICAgIGsgPSBrcC5zaGlmdCgpXG4gICAgICAgIGlmIG5vdCBvW2tdP1xuICAgICAgICAgICAgaWYgbm90IE51bWJlci5pc05hTiBwYXJzZUludCBrXG4gICAgICAgICAgICAgICAgbyA9IG9ba10gPSBbXVxuICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgIG8gPSBvW2tdID0ge31cbiAgICAgICAgZWxzZVxuICAgICAgICAgICAgbyA9IG9ba11cbiAgICAgICAgICAgIFxuICAgIGlmIGtwLmxlbmd0aCA9PSAxIGFuZCBvP1xuICAgICAgICBpZiB2YWx1ZSA9PSB1bmRlZmluZWRcbiAgICAgICAgICAgIGRlbGV0ZSBvW2twWzBdXVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBvW2twWzBdXSA9IHZhbHVlXG4gICAgICAgICAgICBpZiBvW2twWzBdXSAhPSB2YWx1ZVxuICAgICAgICAgICAgICAgIHRocm93IFwiY291bGRuJ3Qgc2V0IHZhbHVlICN7SlNPTi5zdHJpbmdpZnkgdmFsdWV9IGZvciBrZXlwYXRoICN7a2V5cGF0aC5qb2luICcuJ30gaW4gI3tKU09OLnN0cmluZ2lmeSBvYmplY3R9XCJcbiAgICBvYmplY3RcblxubW9kdWxlLmV4cG9ydHMgPSBzZXRcbiJdfQ==
//# sourceURL=…/coffee/set.coffee
Related news
URL Restriction Bypass in GitHub repository plantuml/plantuml prior to V1.2022.5. An attacker can abuse this to bypass URL restrictions that are imposed by the different security profiles and achieve server side request forgery (SSRF). This allows accessing restricted internal resources/servers or sending requests to third party servers.
IBM MQ (IBM MQ for HPE NonStop 8.1.0) can inadvertently disclose sensitive information under certain circumstances to a local user from a stack trace. IBM X-Force ID: 218853.
IBM WebSphere Application Server Liberty 17.0.0.3 through 22.0.0.5 , with the adminCenter-1.0 feature configured, could allow an authenticated user to issue a request to obtain the status of HTTP/HTTPS ports which are accessible by the application server. IBM X-Force ID: 222078.