Arbitrary Code Injection in ownCloud’s Windows Client
The ownCloud Windows desktop client loads Qt plugins from a fixed path under C:\usr\... that any authenticated Windows user can create. A local attacker can place a malicious DLL there, which is then loaded and executed when the client starts.
- Fixed in 17 days
- Paid in 17 days
- Disclosed after 4 months
The current ownCloud Windows Desktop client is prone to an arbitrary code injection vulnerability.
The underlying issue is that the ownCloud desktop client tries to load QT extensions from C:\usr\i686-w64-mingw32\sys-root\mingw\lib\qt5\plugins.
As any authenticated user on Windows is allowed to create new folders within C:, the expected folder structure can be created.
What that means is that a local attacker can create a malicious QT extensions that gets automatically loaded on the next launch of the ownCloud Desktop client.
To verify the issue I first tried to simply create a new QT imageformats plugin. However I failed! Have you ever tried to install QT? So I decided to simply modify an existing DLL.
Hence, I used Hopper to disassemble the qwindows.dll platform’s library to learn more about its entry points. With that knowledge I planned to modify the DLL so that it shows a simply message box. The necessary shellcode was created with Metasploit:
msfvenom -a x86 --platform windows -p windows/messagebox TEXT="DLL Loaded" EXTIFUNC=process -f raw > shellcode cat shellcode |xxd -p
I then overwrote some bytes after one of the previously identified DLL entry points with the shellcode.
After placing the modified payload DLL into C:\usr\i686-w64-mingw32\sys-root\mingw\lib\qt5\plugins\platforms the shellcode got executed after launching the ownCloud desktop client.
Please see the attached PDF for some images documenting the process. Furthermore I created a private screen capture: https://owncloud.bogner.sh/s/Ik8AYJ9FfY5Rkyq
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
Impact
A local attacker with any authenticated Windows account could execute arbitrary code with the privileges of the user who launches the ownCloud client.
What the attacker needed
Local access to a Windows machine; any authenticated Windows user account
How it was found
- Create the expected folder structure under C: as any authenticated user.
- Modify an existing DLL (qwindows.dll) to include shellcode that shows a message box.
- Place the modified DLL into the platforms subfolder of the plugin path.
- Launch the ownCloud desktop client and observe the shellcode 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.
When a program starts, it often loads extra code from files called DLLs. This program looks for those files in a folder that any normal user on the computer is allowed to create. So someone with a normal account can put their own harmful DLL in that folder, and the program will run it the next time it opens.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.