what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

ZPanel Code Execution

ZPanel Code Execution
Posted Apr 17, 2013
Authored by Sven Slootweg

ZPanel suffers from a remote PHP code execution vulnerability.

tags | exploit, remote, php, code execution
SHA-256 | cb33afd179e83c86b0ed86861357632fc5c668bcaac89201cd95e4351ee00eaf

ZPanel Code Execution

Change Mirror Download
Hi all,

There's an arbitrary (PHP) code execution in ZPanel, a free and
open-source shared hosting control panel. Using the included zsudo
binary, access can be escalated and commands can be run as root.

The vulnerability: ZPanel uses a poor "templater" system that
basically consists of a few str_replace calls and an eval... and as
could be expected from something like this, it does a very poor job at
preventing malicious code. The relevant code can be seen here:
https://github.com/bobsta63/zpanelx/blob/master/dryden/ui/templateparser.class.php
(note the poor attempt at stripping out <?php and ?> tags).

By effectively injecting the replacement that occurs in line 71, one
can run arbitrary PHP code. When combined with ZPanels `zsudo` binary,
one can execute arbitrary commands as root, with a maximum of 5
additional arguments (aside from the path to the
to-be-executed-command).

The scope: Custom templates/themes can be uploaded by resellers and
administrators. This effectively means that anyone that can get access
to a reseller account through any means, including by purchasing a
reseller service from a ZPanel-using host, can gain root access,
without detection.

PoC: Insert the following code anywhere in master.ztml or any other
template that is parsed by the template parser, replacing `touch derp`
with any command of choice:

<& bogus']; exec("/etc/zpanel/panel/bin/zsudo touch /root/derp"); echo
$value['bogus &>

Strangely, login.ztml does not appear to use the templater, and seems
to allow PHP execution by simply using <?php and ?> tags (which I
would consider a vulnerability in itself, but that aside).

Vendor notification: I have warned the ZPanel development team about
their insecure templater *months* ago, and explicitly pointed out that
their "PHP code filtering" was not going to work well. I have
submitted a patch for some other fixable aspects of the templater
(which was merged into the main repository), but the development team
insisted that the security in the templater was fine, and that it
wasn't a problem, basically telling me that they were not going to
change it. They have not fixed this vulnerability, nor do they appear
to have any interest in doing so in the near future.

How to solve it: Either remove the reseller template uploading
functionality (this would impair core functionality), or use a real
templating engine that does not use a few str_replace() calls strung
together in front of an eval().

I'm quite new to this list, and not exactly a pentesting expert, so if
I left out some important information in the above message, please do
let me know.

- Sven Slootweg


Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close