Kwetsbaarheid in Ghostscript, uitgebuit via ImageMagick

In Ghostscript, a toolkit for processing, converting, and generating documents in PostScript and PDF formats, a critical vulnerability (CVE-2021-3781) has been identified, allowing arbitrary code execution when processing a specially crafted file. The issue was initially pointed out by Emil Lerner, who discussed the vulnerability on August 25 at the ZeroNights X conference in St. Petersburg, where he shared how he used the vulnerability within bug bounty programs to earn rewards for demonstrating attacks on services like AirBNB, Dropbox, and Yandex.Real Estate.

On September 5, a working exploit became publicly available, allowing attacks on systems running Ubuntu 20.04 by sending a specially crafted document, disguised as an image, to a web script using the php-imagemagick package on the server. Preliminary reports indicated that such an exploit had been in circulation since March. There were claims of potential attacks on systems with GhostScript 9.50, but it was found that the vulnerability also exists in all subsequent versions of GhostScript, including the upcoming 9.55 release from Git.

A fix was proposed on September 8 and accepted into the GhostScript repository on September 9 after review. In many distributions, the issue remains unpatched (the update publication status can be viewed on the pages of Debian, Ubuntu, Fedora, SUSE, RHEL, Arch Linux, FreeBSD, NetBSD). A release of GhostScript with a patch for the vulnerability is planned to be published by the end of the month.

The issue is caused by the ability to bypass the ā€˜-dSAFER’ isolation mode due to insufficient checks of the Postscript device parameters ā€˜%pipe%’, allowing arbitrary shell commands to be executed. For example, to run the id utility in a document, it is sufficient to specify the line ā€˜(%pipe%/tmp/&id)(w)file’ or ā€˜(%pipe%/tmp/;id)(r)file’.

Het is belangrijk om te herinneren dat kwetsbaarheden in Ghostscript een verhoogd risico met zich meebrengen, aangezien dit pakket in veel populaire toepassingen voor de verwerking van PostScript- en PDF-formaten wordt gebruikt. Ghostscript wordt bijvoorbeeld aangeroepen tijdens het maken van miniaturen op het bureaublad, bij achtergrondindexering van gegevens en bij het converteren van afbeeldingen. Voor een succesvolle aanval is het in veel gevallen voldoende om gewoon een bestand met een exploit te uploaden of een map met dergelijke bestanden te bekijken in een bestandsbeheerder die het weergeven van documentminiaturen ondersteunt, zoals Nautilus.

Kwetsbaarheden in Ghostscript kunnen ook worden geƫxploiteerd via afbeeldingsbehandelaars gebaseerd op de pakketten ImageMagick en GraphicsMagick, door een JPEG- of PNG-bestand door te geven waarin in plaats van een afbeelding PostScript-code staat (dit bestand wordt in Ghostscript verwerkt, omdat het MIME-type op basis van de inhoud wordt herkend, en niet alleen op basis van de extensie).

Bron: opennet.ru

Koop betrouwbare webhosting met bescherming tegen DDoS, VPS VDS servers šŸ”„ Koop betrouwbare webhosting met bescherming tegen DDoS, VPS VDS servers | ProHoster