{"id":16693,"date":"2021-07-07T16:32:49","date_gmt":"2021-07-07T14:32:49","guid":{"rendered":"https:\/\/herolab-usd.formwandler.rocks\/security-advisories\/usd-2020-0041\/"},"modified":"2021-07-19T14:16:13","modified_gmt":"2021-07-19T12:16:13","slug":"usd-2020-0041","status":"publish","type":"page","link":"https:\/\/herolab.usd.de\/en\/security-advisories\/usd-2020-0041\/","title":{"rendered":"usd-2020-0041"},"content":{"rendered":"<p>[et_pb_section fb_built=\"1\" _builder_version=\"4.9.4\" _module_preset=\"default\" background_color=\"#2E353D\" custom_padding=\"||0px|||\"][et_pb_row _builder_version=\"4.9.4\" _module_preset=\"default\"][et_pb_column type=\"4_4\" _builder_version=\"4.9.4\" _module_preset=\"default\"][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<h1 class=\"h-custom-headline usd-small-letters h2\"><span>usd-2020-0041 | Concrete5 v8.5.2<\/span><\/h1>\n<p><span><\/span><\/p>\n<p><span><\/span><strong>Advisory ID<\/strong><span>: usd-2020-0041<\/span><br \/><strong>CVE Number<\/strong><span>: CVE-2020-11476<\/span><br \/><strong>Affected Product<\/strong><span>: Concrete5 CMS<\/span><br \/><strong>Affected Version<\/strong><span>: 8.5.2<\/span><br \/><strong>Vulnerability Type<\/strong><span>: Unrestricted Upload of File with Dangerous Type<\/span><br \/><strong>Security Risk<\/strong><span>: High<\/span><br \/><strong>Vendor URL<\/strong><span>: <a href=\"https:\/\/www.concrete5.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.concrete5.org\/<\/a><\/span><br \/><strong>Vendor Status<\/strong><span>: Fixed in 8.5.3<\/span><\/p>\n<h3><\/h3>\n<h3><\/h3>\n<h3><\/h3>\n<h3>Description<\/h3>\n<div class=\"x-text\">\n<p>The web application \u201econcrete5\u201c is vulnerable to remote code execution. An attacker can define uploadable filetypes in the admin area. The application blocks uploads with file extensions like <em>php<\/em> and <em>phtml<\/em> but not <em>phar, php8, shtml, cgi, pl, phpsh, pht and .htaccess<\/em>.<br \/>It is for instance possible for an attacker to upload <em>phar<\/em> files and access them via the browser after some configuration settings in the admin area. This file extension is interpreted as PHP code by many web servers, which allows code execution.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"x-text\">\n<p>It is possible for an authenticated admin to specify the uploadable file formats in the \u201eAllowed File Types\u201c section under the URL http:\/\/localhost\/index.php\/dashboard\/system\/files\/filetypes. According to the page, the following file extensions are blocked:<\/p>\n<\/div>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"]These file extensions will always be blocked: php, php2, php3, php4, php5, php7, phtml<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<p>However there are other file formats that are interpreted as PHP by many web servers. One of these file extensions is <em>.phar<\/em>. After adding this file extension, it is possible to upload <em>.phar<\/em>\u00a0files in the upload section, which are stored on the web server. If an attacker accesses the uploaded file via his browser, this file is interpreted as php and allows code execution.<\/p>\n<h3><span><\/span><\/h3>\n<h3><span><\/span><\/h3>\n<h3><span><\/span><\/h3>\n<h3><span>Proof of Concept (PoC)<\/span><\/h3>\n<div class=\"x-text\">\n<p>First visit the section \u201eAllowed file types\u201c under the URL <a href=\"http:\/\/localhost\/index.php\/dashboard\/system\/files\/filetypes\" data-wplink-url-error=\"true\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost\/index.php\/dashboard\/system\/files\/filetype<\/a>. The .<em>phar<\/em>\u00a0format must be added to the list there.<\/p>\n<p>Create a new file <em>shell.phar<\/em> with the following contents:<\/p>\n<\/div>\n<p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2021\/07\/usd20200041.png\" title_text=\"usd20200041\" _builder_version=\"4.9.4\" _module_preset=\"default\"][\/et_pb_image][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\"]<\/p>\n<p>Afterwards visit the following page: <a href=\"http:\/\/localhost\/concrete5\/index.php\/dashboard\/files\/search\" data-wplink-url-error=\"true\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost\/concrete5\/index.php\/dashboard\/files\/search<\/a>.<br \/>On this page it is possible to upload new files and get information about already uploaded files.<\/p>\n<p>Next step is to upload the created file <em>shell.phar<\/em>. After the successful upload of the file it is possible to view the URL of the file. On the same page it is possible to search for the file name <em>shell.phar<\/em> in the file search bar. By right-clicking on the file and selecting \u201eProperties\u201c you can get the path where the file was saved. The following information would then be displayed:<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"]Filename \tshell.phar<br \/>\nURL to File\thttp:\/\/localhost\/application\/files\/4015\/8558\/7320\/shell.phar<br \/>\nTracked URL\thttp:\/\/localhost\/concrete5\/index.php\/download_file\/21\/0<br \/>\nFolder\t\tFile Manager<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<div class=\"e16902-22 x-container max width\">\n<div class=\"e16902-23 x-column x-sm x-1-1\">\n<p><span>The attacker can now visit the received URL and enter system commands in the <\/span><em>cmd<\/em><span> GET parameter which should be executed on the system. The visiting the following URL would execute the system command \u201ewhoami\u201c: <\/span><a href=\"http:\/\/localhost\/application\/files\/4015\/8558\/7320\/shell.phar?cmd=whoami\" data-wplink-url-error=\"true\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost\/application\/files\/4015\/8558\/7320\/shell.phar?cmd=whoami<\/a><\/p>\n<h3><\/h3>\n<h3>Fix<\/h3>\n<p><span>Although it is possible to add the file extension <\/span><em>.phar<\/em><span> to the <\/span><em>concrete.upload.extensions_blacklist<\/em><span> this would only be a temporary solution. There are many other file extensions which some web servers interpret as PHP code. It is more difficult to cover all file extensions with a blacklist than to build a whitelist of possible file formats. It would make sense to introduce a <\/span><em>concrete.upload.extensions_whitelist<\/em><span>\u00a0which is defined in the code. This way, a user who already has access to the system can modify it. The section \u201eAllowed File Types\u201c should not allow a user to modify the allowed file formats, it should only display uploadable formats.<\/span><\/p>\n<h3><\/h3>\n<h3>Timeline<\/h3>\n<ul>\n<li>2020-03-31 Vulnerability was discovered<\/li>\n<li>2020-04-01 First contact attempt via security@concrete5.org<\/li>\n<li>2020-05-14 Second contact attempt via security@concrete5.org<\/li>\n<li>2020-05-14 Report on https:\/\/hackerone.com<\/li>\n<li>2020-06-03 Public pull request with fix at <a href=\"https:\/\/github.com\/concrete5\/concrete5\/pull\/8713\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/concrete5\/concrete5\/pull\/8713<\/a><\/li>\n<li>2020-06-04 Version 8.5.3 is released and fixes the vulnerability: <a href=\"https:\/\/github.com\/concrete5\/concrete5\/releases\/tag\/8.5.3\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/concrete5\/concrete5\/releases\/tag\/8.5.3<\/a><\/li>\n<li><span>2020-07-15 Security advisory released<\/span><\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Credits<\/h3>\n<p><span>This security vulnerability was found by Gerbert Roitburd of usd AG.<\/span><\/p>\n<\/div>\n<\/div>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>usd-2020-0041 | Concrete5 v8.5.2 Advisory ID: usd-2020-0041CVE Number: CVE-2020-11476Affected Product: Concrete5 CMSAffected Version: 8.5.2Vulnerability Type: Unrestricted Upload of File with Dangerous TypeSecurity Risk: HighVendor URL: https:\/\/www.concrete5.org\/Vendor Status: Fixed in 8.5.3 Description The web application \u201econcrete5\u201c is vulnerable to remote code execution. An attacker can define uploadable filetypes in the admin area. The application blocks uploads [&hellip;]<\/p>\n","protected":false},"author":96,"featured_media":0,"parent":16124,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"class_list":["post-16693","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/users\/96"}],"replies":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/comments?post=16693"}],"version-history":[{"count":0,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16693\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16124"}],"wp:attachment":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/media?parent=16693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}