Aerosol Posted December 3, 2014 Report Posted December 3, 2014 Advisory: Remote Code Execution in TYPO3 Extension ke_dompdfDuring a penetration test RedTeam Pentesting discovered a remote codeexecution vulnerability in the TYPO3 extension ke_dompdf, which allowsattackers to execute arbitrary PHP commands in the context of thewebserver. Details=======Product: ke_dompdf TYPO3 extensionAffected Versions: 0.0.3<=Fixed Versions: 0.0.5Vulnerability Type: Remote Code ExecutionSecurity Risk: highVendor URL: http://typo3.org/extensions/repository/view/ke_dompdfVendor Status: fixed version releasedAdvisory URL: https://www.redteam-pentesting.de/advisories/rt-sa-2014-007Advisory Status: publishedCVE: CVE-2014-6235CVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6235Introduction============"DomPDF library and a small pi1 to show how to use DomPDF to render thecurrent typo3-page to pdf."(taken from the extension's description)More Details============The TYPO3 extension ke_dompdf contains a version of the dompdf libraryincluding all files originally supplied with it. This includes anexamples page, which contains different examples for HTML-entitiesrendered as a PDF. This page also allows users to enter their own HTMLcode into a text box to be rendered by the webserver using dompdf.dompdf also supports rendering of PHP files and the examples page alsoaccepts PHP code tags, which are then executed and rendered into a PDFon the server.Since those files are not protected in the TYPO3 extension directory,anyone can access this URL and execute arbitrary PHP code on the system.This behaviour was already fixed in the dompdf library, but the typo3extension ke_dompdf supplies an old version of the library that stillallows the execution of arbitrary PHP code.Proof of Concept================Access examples.php on the vulnerable system:http://www.example.com/typo3conf/ext/ke_dompdf/res/dompdf/www/examples.phpEnter PHP code in the text box on the bottom of the page and click thesubmit button, for example:------------------------------------------------------------------------<?php phpinfo() ?>------------------------------------------------------------------------The page will return a PDF file containing the output of the PHP code.Workaround==========Remove the directory "www" containing the examples.php file or at leastthe examples.php file from the extensions' directory.Fix===Update to version 0.0.5 of the extension.Security Risk=============highTimeline========2014-04-21 Vulnerability identified2014-04-30 Customer approved disclosure to vendor2014-05-06 CVE number requested2014-05-10 CVE number assigned2014-05-13 Vendor notified2014-05-20 Vendor works with TYPO3 security team on a fix2014-09-02 Vendor released fixed version [2]2014-12-01 Advisory releasedReferences==========The TYPO3 extension ke_dompdf contains an old version of the dompdflibrary, which contains an example file that can be used to executearbitrary commands. This vulnerability was fixed in dompdf in 2010. Therelevant change can be found in the github repository of dompdf:[1] https://github.com/dompdf/dompdf/commit/ e75929ac6393653a56e84dffc9eac1ce3fb90216TYPO3-EXT-SA-2014-010: Several vulnerabilities in third party extensions:[2] http://typo3.org/teams/security/security-bulletins/typo3-extensions/ typo3-ext-sa-2014-010/Source Quote