exploit the possibilities
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:
(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

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:

May 2023

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

Top Authors In Last 30 Days

File Tags


packet storm

© 2022 Packet Storm. All rights reserved.

Security Services
Hosting By