Уязвимость ZIP существует в Epiphany при установке пакетов WebExtension из файлов .xpi. В src/webextension/ephy-web-extension-manager.c функция decompress_xpi_thread() извлекает архивы XPI (формат ZIP) на диск с помощью libarchive. Для каждой записи архива выходной путь строится путем сопряжения предполагаемого каталога извлечения с необработанным именем пути из архива: full_path g_build_filename(path, archive_entry_pathname(entry, NULL); archive_entry_set_pathname(entry, full_path; ret archive_write_header(ext, entry); Варианты извлечения libarchive не включали ARCHIVE_EXTRACT_SECURE_NODOTDOT или ARCHIVE_EXTRACT_SECURE_SYMLINKS.
В результате записи архива, содержащие последовательности обхода родительских каталогов (например, "../../../../.bashrc"), записываются вне предполагаемого каталога извлечения web_extensions. Таким образом, вредоносный файл .xpi может перезаписывать произвольные файлы, записываемые пользователем, работающим под управлением Epiphany, такие как /.bashrc, ~/.config/autostart/*.desktop или ~/.ssh/authorized_keys. Это может привести к постоянному выполнению кода при последующем запуске оболочки или логине GNOME.
Эксплуатация требует, чтобы жертва установила или открыла созданный файл .xpi. Репортер отмечает, что открытие XPI может вызвать извлечение, даже если функция WebExtensions не включена по умолчанию. Затронутые версии: Epiphany 47.rc.
Исправлено вверх по течению в epiphany 50.6 и 49.9 через запрос слияния !2143, который добавляет ARCHIVE_EXTRACT_SECURE_NODOTDOT и ARCHIVE_EXTRACT_SECURE_SYMLINKS в archive_write_disk_set_options(). Верхний отчет: https://gitlab.gnome.org/GNOME/epiphany/-/issues/2922
Показать оригинальное описание (EN)
A path traversal (ZIP slip) vulnerability exists in Epiphany when installing WebExtension packages from .xpi files. In src/webextension/ephy-web-extension-manager.c, the decompress_xpi_thread() function extracts XPI archives (ZIP format) to disk using libarchive. For each archive entry, the output path is built by concatenating the intended extraction directory with the raw pathname from the archive: full_path = g_build_filename(path, archive_entry_pathname(entry), NULL); archive_entry_set_pathname(entry, full_path); ret = archive_write_header(ext, entry); The libarchive extraction options did not include ARCHIVE_EXTRACT_SECURE_NODOTDOT or ARCHIVE_EXTRACT_SECURE_SYMLINKS. As a result, archive entries containing parent-directory traversal sequences (for example "../../../../../.bashrc") are written outside the intended web_extensions extraction directory. A malicious .xpi file can therefore overwrite arbitrary files writable by the user running Epiphany, such as ~/.bashrc, ~/.config/autostart/*.desktop, or ~/.ssh/authorized_keys. This can lead to persistent code execution on subsequent shell startup or GNOME login. Exploitation requires the victim to install or open a crafted .xpi file. The reporter notes that opening an XPI can trigger extraction even when the WebExtensions feature is not enabled by default. Affected versions: Epiphany >= 47.rc. Fixed upstream in epiphany 50.6 and 49.9 via merge request !2143, which adds ARCHIVE_EXTRACT_SECURE_NODOTDOT and ARCHIVE_EXTRACT_SECURE_SYMLINKS to archive_write_disk_set_options(). Upstream report: https://gitlab.gnome.org/GNOME/epiphany/-/issues/2922