Remote Code Execution via Insecure Deserialization in Telerik UI
An outdated Telerik Web UI version was vulnerable to a file upload flaw and a deserialization flaw, which together allowed remote code execution. The attacker demonstrated this by uploading a DLL that caused the server to sleep for ten seconds.
Originally disclosed on HackerOne
- Triaged in 5 hours
- Fixed in 31 days
- Disclosed after 34 days
Hello, I found an outdated version of Telerik Web UI (v2016.2.607.40) at the following URL: https://███/Telerik.Web.UI.WebResource.axd?type=rau. This means that we can achieve full RCE by chaining two different CVEs: CVE-2017-11317, which allows us to upload arbitrary files on the server, and CVE-2019-18935, which is a deserialization vulnerability.
First of all, the only thing that I tried to prove that I had successfully achieved code execution was making the server sleep for 10 seconds. No data was compromised.
Steps to reproduce
The steps that I followed are thoroughly described in this blog post: https://know.bishopfox.com/research/cve-2019-18935-remote-code-execution-in-telerik-ui. Here's a quick summary:
- Download the files in the attachments
- Make sure you have pycryptodome installed (pip3 install pycryptodome)
- Run the following command:
python3 CVE-2019-18935.py -u https://█████/Telerik.Web.UI.WebResource.axd?type=rau -v 2016.2.607.40 -f 'C:\Windows\Temp' -p sleep_042020163752,45_amd64.dll - The
sleep_042020160430,40_amd64.dllis supposed to Sleep(10). This will make the server hang for roughly ten seconds, and after that you will get a response like this one:[*] Response time: 12.88 seconds - The exploit worked.
Things to note
I had to edit the original exploit code provided in the aforementioned blog post (https://github.com/noperator/CVE-2019-18935) because I noticed that when uploading the .dll file the server added a .tmp at the end of the file name.
That's why the original code was failing to exploit the deserialization part.
I added + '.tmp' at the end of line 95 and after that it worked just fine.
A DLL file can only work once. This means that to test the vulnerability again a new DLL has to be compiled. For this reason I provided several DLLs in the attachments so you don't have to compile them (especially because a windows machine with Visual Studio installed is required).
I didn't upload a reverse shell because I thought it was not a great idea, but if needed I could do it.
How to fix
Just upgrade Telerik for ASP.NET AJAX to R3 2019 SP1 (v2019.3.1023) or later.
Impact
Full Remote Code Execution on the vulnerable server.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the outdated Telerik UI version contained an insecure file upload and a deserialization vulnerability that, when chained, allowed arbitrary code execution.
Impact
Full remote code execution on the vulnerable server, though the attacker only demonstrated a time delay and did not compromise data.
What the attacker needed
Outdated Telerik UI version; Network access to the Telerik endpoint; Ability to upload files to a writable directory
The fix
Upgrade Telerik for ASP.NET AJAX to R3 2019 SP1 (v2019.3.1023) or later.
How it was found
- Download the exploit files from the attachments.
- Install the required Python library pycryptodome.
- Run the exploit script with the target URL, version, upload path, and a DLL that sleeps.
- Observe the server response time to confirm the sleep, indicating code execution.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The server was running an old version of a software component that had two known security holes. One hole let an attacker upload files, and the other let those files be run as code. By combining them, the attacker could run their own code on the server, which is called remote code execution.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.