Active Storage позволяет легко загружать и ссылаться на файлы в облачных сервисах и прикреплять эти файлы к объектам Active Record. До 8.1.4.1 и 8.0.5.2 ActiveStorage::Blob#open записывает blob в темпфайл, имя которого несет расширение загруженного имени файла, и передает этот путь в ffprobe (VideoAnalyzer, AudioAnalyzer), ffmpeg (VideoPreviewer) и ImageMagick (ImageAnalyzer, процессор варианта :mini_magick). Эти инструменты выбирают декодер из расширения файла, когда контент не идентифицирует свой собственный формат, поэтому злоумышленник, который выбирает имя файла и объявляет тип содержимого загрузки, выбирает, какой декодер обрабатывает его.
FFmpeg, построенный с поддержкой AviSynth, рассматривает файл с расширением .avs как скрипт AviSynth и оценивает его, который может раскрывать файлы, читаемые процессом приложения через образ предварительного просмотра, или загружать нативную библиотеку, которую также загрузил злоумышленник, что может привести к удаленному выполнению кода в процессе FFmpeg. ImageMagick выбирает своих кодировщиков и делегатов из расширения таким же образом. Приложение подвержено влиянию, если оно принимает загрузки от ненадежных пользователей и анализирует видео или аудио вложения, генерирует предварительный просмотр видео или обрабатывает изображения с помощью ImageMagick. Для атаки AviSynth дополнительно требуется FFmpeg, построенный с --enable-avisynth и AviSynthPlus runtime на хосте.
FFmpeg и общие дистрибутивы Linux и Homebrew не позволяют этого; сборки GPL, распределенные для Windows и Linux с ffmpeg.org, делают это. Другие декодеры, которые FFmpeg или ImageMagick выбирают из расширения, могут быть доступны без AviSynth. Эта проблема исправлена в версиях 8.1.4.1 и 8.0.5.2.
Показать оригинальное описание (EN)
Active Storage makes it simple to upload and reference files in cloud services and attach those files to Active Record objects. Prior to 8.1.4.1 and 8.0.5.2, ActiveStorage::Blob#open writes a blob to a tempfile whose name carries the extension of the uploaded filename, and hands that path to ffprobe (VideoAnalyzer, AudioAnalyzer), ffmpeg (VideoPreviewer) and ImageMagick (ImageAnalyzer, the :mini_magick variant processor). These tools select a decoder from the file extension when the content does not identify its own format, so an attacker who chooses the filename and declares the content type of an upload chooses which decoder processes it. An FFmpeg built with AviSynth support treats a file with the .avs extension as an AviSynth script and evaluates it, which could disclose files readable by the application process through the preview image, or load a native library the attacker has also uploaded, possibly leading to remote code execution in the FFmpeg process. ImageMagick selects its coders and delegates from the extension in the same way. An application is affected if it accepts uploads from untrusted users and analyzes video or audio attachments, generates video previews, or processes images with ImageMagick. The AviSynth attack additionally requires an FFmpeg built with --enable-avisynth and the AviSynthPlus runtime on the host. Upstream FFmpeg and the common Linux distribution and Homebrew packages do not enable it; the GPL builds distributed for Windows and Linux from ffmpeg.org do. Other decoders that FFmpeg or ImageMagick select from the extension may be reachable without AviSynth. This issue is fixed in versions 8.1.4.1 and 8.0.5.2.
Характеристики атаки
Последствия
Строка CVSS v3.1