Calling a wrapper (privilege escalation) from PHP since cPanel 11.38
Hi all,
I tried to make the example *PrivEscExample.tar.gz* to work but I cannot find how to call the Namespace/module/function from PHP.
For short, how to translate this call in PHP :
Before cPanel 11.38, something like the following code would have worked :
But now it didn't work anymore as it try to load a module which is not present anymore. I tried the following which seems to me a good candidate :
But it seems that the "Wrap" module lacks the function "send_cpwrapd_request". As I didn't find any documentation explaining how to access the wrapper function from PHP, could someone from cPanel staff give me some hints or point me to the explanations that I missed. Thanks in advance. Cheers, Philipppe
my $result = Cpanel::Wrap::send_cpwrapd_request(
'namespace' => 'MyNamespace',
'module' => 'MyExample',
'function' => 'ECHO',
'data' => 'Hello World !'
);
Before cPanel 11.38, something like the following code would have worked :
$this->cpanel = new CPANEL();
$param['data"> = 'Hello World!';
$res = $this->cpanel->api2('MyExample', 'ECHO', $param);
But now it didn't work anymore as it try to load a module which is not present anymore. I tried the following which seems to me a good candidate :
$param['namespace"> = 'MyNamespace';
$param['module"> = 'MyExample';
$param['function"> = 'ECHO';
$param['data"> = 'Hello World!';
$res = $this->cpanel->api2('Wrap', 'send_cpwrapd_request', $param);
But it seems that the "Wrap" module lacks the function "send_cpwrapd_request". As I didn't find any documentation explaining how to access the wrapper function from PHP, could someone from cPanel staff give me some hints or point me to the explanations that I missed. Thanks in advance. Cheers, Philipppe
-
Hi all, In fact it seems that it is not possible to make the same call with PHP as the documentation tell how to make it with Perl. We finally stay with the old way that generate the following error for each call : error_log:cpwrapd: falling back to using legacy adminbin: /usr/local/cpanel/bin/tzbmadmin
Cheers, Philippe0 -
Hello, same problem. How can we reach this? How do you call the priv. escal. wrapper? 0 -
Hello, I've merged your posts into this thread, as there's no need to post the same question to multiple threads. Thank you. 0 -
Hello, Here's the response to the associated support ticket for this issue from David N: [QUOTE] Hello, Thanks for contacting us. The way cpwrap is written, the only language that can interface with it is Perl. However, it's possible (and not very difficult) to write a thin custom UAPI module with a call (or calls) that wraps your cpwrap call. Your LiveAPI page will then use $cpanel->uapi to invoke the custom UAPI call you've written. I recommend reading over the custom UAPI modules documentation if you haven't already: 0 -
Hi Mrg, We do exactely as cPanelMichael tell you : 1) Created a custom module (TZBM.pm) 2) Installed the custom module in /usr/local/cpanel/Cpanel/ 3) Call it from PHP with something like : $cpanel->api2('TZBM', 'genmailboxlistfile', $param); Hope this help. Cheers, Philippe 0
Please sign in to leave a comment.
Comments
6 comments