Версия безопасности декабрь 2021 года/ЧЗВ
В MediaWiki обнаружен ряд уязвимостей, которые позволяют злоумышленнику получить доступ к содержимому страниц из закрытых вики-проектов и обойти разрешения на редактирование.
Основным вектором этой атаки является использование уязвимых действий на страницах, которые перечислены в $wgWhitelistRead
и, следовательно, общедоступны.
MediaWiki теперь по умолчанию делает действие «Просмотр» общедоступным только на страницах в $wgWhitelistRead
.
These issues are fixed in 1.35.5, 1.36.3, and 1.37.1, see the announcement for links to tarballs and patches.
Что за проблемы?
- CVE-2021-44858: The "undo" feature (
action=edit&undo=##&undoafter=###
) allowed an attacker to view the contents of arbitrary revisions, regardless of whether they had permissions to do so. This was also found in the "mcrundo" and "mcrrestore" actions (action=mcrundo
andaction=mcrrestore
).
- CVE-2021-45038: The "rollback" feature (
action=rollback
) could be passed a specially crafted parameter that allowed an attacker to view the contents of arbitrary pages, regardless of whether they had permissions to do so.
- CVE-2021-44857: The "mcrundo" and "mcrrestore" actions (
action=mcrundo
andaction=mcrrestore
) did not properly check for editing permissions, and allowed an attacker to take the content of any arbitrary revision and save it on any page of their choosing. This affects both public wikis and public pages on private wikis.
У меня нет времени устанавливать патчи, как мне это отключить?
Добавьте следующий код в ваш LocalSettings.php:
$wgActions['mcrundo'] = false;
$wgActions['mcrrestore'] = false;
Если ваша вики является частной (для просмотра страниц требуется вход в систему), вам также необходимо установить:
$wgWhitelistRead = [];
$wgWhitelistReadRegexp = [];
It should fully disable the vulnerable code. These changes will also work for vulnerable end-of-life MediaWiki versions that do not have a patch available.
If you used $wgWhitelistRead
to allow logged-out users to see the main page with help text, you should instead move that help text to the MediaWiki:Loginreqpagetext message, which is shown on the "login required" error.
Меня это коснулось?
- Если ваша вики публичная (любой может читать страницы): да
- Если ваша вики частная, но
$wgWhitelistRead
или$wgWhitelistReadRegexp
имеет хотя бы одну страницу: да
Если вы используете расширения вроде Lockdown или Whitelist Pages , чтобы сделать некоторые страницы нечитаемыми для некоторых участников, вы, скорее всего, также подвержены этой проблеме.
Какие версии уязвимы?
Все версии MediaWiki с 1.23.0 по 1.34.x и 1.35.x, 1.36.x, 1.37.x до исправлений (см. верхний раздел) уязвимы для обхода разрешений на чтение в приватной вики (CVE-2021-44858, CVE-2021-45038).
Все версии MediaWiki с 1.32.0 по 1.34.x, а также 1.35.x, 1.36.x, 1.37.x до исправлений (см. верхний раздел) уязвимы для обхода прав редактирования (CVE-2021-44857).
How is this being fixed long-term?
All actions except "view" now require an explicit "read" user right. This is similar to permission checks used in the Action and REST APIs. If further vulnerabilities are found in actions, they will at least not be exploitable by logged-out users on private wikis.
Actions that need to be usable on $wgWhitelistRead
pages can override the new Action::needsReadRight()
function.
Как я могу узнать, воспользовался ли кто-нибудь этой уязвимостью в моей вики?
Look for action=mcrundo
or action=mcrrestore
in your access logs. Unless you specifically enabled an extension that uses multi-content revisions, there is no legitimate use for these actions.
In addition, look for action=edit&undo=###&undoafter=###
requests and check whether the revision IDs belong to a different title than the page being edited.
For the rollback bug, look for action=rollback&from=...
where the "from" parameter is a template transclusion (for example, from={{:private page}}
).
This bug does not cause any data loss, so any write actions an attacker could have taken will be recorded in page history like all other edits.
Credit
Проблему обнаружил Dylsss, большое ему спасибо за выявление и сообщение о проблеме. Если вы обнаружили ошибку в MediaWiki, ознакомьтесь с процессом сообщения об ошибках безопасности.