PrivateBin — это онлайн-хранилище, в котором сервер ничего не знает о вставленных данных. До версии 2.0.5 Request::getRequestUri() в lib/Request.php передает $_SERVER['REQUEST_URI'] через FILTER_SANITIZE_URL, который не удаляет кавычки, угловые скобки или апострофы, а Controller::_init() сохраняет контролируемое злоумышленником значение в Controller::$_urlBase. Controller::_jsonld() в lib/Controller.php затем использует str_replace() для вставки этого значения без экранирования JSON в js/types.jsonld, js/paste.jsonld и другие шаблоны JSON-LD, используемые /?jsonld= и /?pasteid.
Необработанная кавычка, доставленная HTTP-клиентом, прокси-сервером или сканером структурированных данных, который не нормализует цель запроса, может выйти за пределы строки JSON и внедрить произвольные данные «ключ-значение» в ответ CORS-open application/ld+json. Ветка jsonld в Controller::__construct() возвращает результат до _setCacheHeaders(), поэтому в ответе также отсутствуют параметры X-Content-Type: nosniff, Content Security Policy, X-Frame-Options и Referrer-Policy. Прямое выполнение сценария не было продемонстрировано, но манипулируемые ответы могут повлиять на потребителей структурированных данных или объединиться с менее строгими клиентами.
Эта проблема исправлена в версии 2.0.5.
Показать оригинальное описание (EN)
PrivateBin is an online pastebin where the server has zero knowledge of pasted data. Prior to 2.0.5, Request::getRequestUri() in lib/Request.php passes $_SERVER['REQUEST_URI'] through FILTER_SANITIZE_URL, which does not remove quotation marks, angle brackets, or apostrophes, and Controller::_init() stores the attacker-controlled value in Controller::$_urlBase. Controller::_jsonld() in lib/Controller.php then uses str_replace() to insert that value without JSON escaping into js/types.jsonld, js/paste.jsonld, and the other JSON-LD templates used by /?jsonld= and /?pasteid. A raw quotation mark delivered by an HTTP client, proxy, or structured-data crawler that does not normalize the request target can break out of the JSON string and inject arbitrary key-value data into a CORS-open application/ld+json response. The jsonld branch in Controller::__construct() returns before _setCacheHeaders(), so the response also lacks X-Content-Type-Options: nosniff, Content Security Policy, X-Frame-Options, and Referrer-Policy. Direct script execution was not demonstrated, but manipulated responses can affect structured-data consumers or combine with less strict clients. This issue is fixed in version 2.0.5.
Характеристики атаки
Последствия
Строка CVSS v3.1