JavaScript Cookie — это API JavaScript для обработки файлов cookie на стороне клиента. До версии 3.0.7 внутренний помощник Assign() js-cookie копирует свойства с помощью for...in + Plain присваивания. Когда исходный объект создается с помощью JSON.parse, член объекта JSON «__proto__» является собственным перечисляемым свойством, поэтому for…in перечисляет его, а запись target[key] = source[key] запускает установщик Object.prototype.__proto__ для новой цели ({}).
Результатом является захват прототипа для каждого экземпляра: сам Object.prototype остается нетронутым, но объект объединенных атрибутов теперь наследует ключи, контролируемые злоумышленником. Поскольку потребляющая функция set() затем перечисляет объединенный объект с другим for...in, каждый ключ, который злоумышленник поместил в загрязненный прототип, попадает в результирующую строку Set-Cookie в виде пары атрибутов. Злоумышленник может установить домен=, Secure=, Samesite=, expires= и path= для файлов cookie, атрибуты которых, по мнению разработчика, были заблокированы.
Эта проблема исправлена в версии 3.0.7.
Показать оригинальное описание (EN)
JavaScript Cookie is a JavaScript API for handling cookies, client-side. Prior to version 3.0.7, js-cookie's internal assign() helper copies properties with for...in + plain assignment. When the source object is produced by JSON.parse, the JSON object's "__proto__" member is an own enumerable property, so the for…in enumerates it and the target[key] = source[key] write triggers the Object.prototype.__proto__ setter on the fresh target ({}). The result is a per-instance prototype hijack: Object.prototype itself is untouched, but the merged attributes object now inherits attacker-controlled keys. Because the consuming set() function then enumerates the merged object with another for...in, every key the attacker placed on the polluted prototype lands in the resulting Set-Cookie string as an attribute pair. The attacker can set domain=, secure=, samesite=, expires=, and path= on cookies whose attributes the developer thought were locked down. This issue has been patched in version 3.0.7.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Js-Cookie Javascript_Cookie
cpe:2.3:a:js-cookie:javascript_cookie:*:*:*:*:*:node.js:*:*
|
— |
3.0.7
|
|
Redhat 3scale_Api_Management
cpe:2.3:a:redhat:3scale_api_management:2.0:*:*:*:*:*:*:*
|
— | — |
|
Redhat Ansible_Automation_Platform
cpe:2.3:a:redhat:ansible_automation_platform:2.0:*:*:*:*:*:*:*
|
— | — |
|
Redhat Openshift_Ai
cpe:2.3:a:redhat:openshift_ai:-:*:*:*:*:*:*:*
|
— | — |
|
Redhat Openshift_Lightspeed
cpe:2.3:a:redhat:openshift_lightspeed:-:*:*:*:*:*:*:*
|
— | — |
|
Redhat Enterprise_Linux
cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*
|
— | — |
|
Redhat Enterprise_Linux
cpe:2.3:o:redhat:enterprise_linux:9.0:*:*:*:*:*:*:*
|
— | — |
|
Redhat Enterprise_Linux
cpe:2.3:o:redhat:enterprise_linux:10.0:*:*:*:*:*:*:*
|
— | — |