We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc10af5 commit 8613f15Copy full SHA for 8613f15
web/src/app/System/HestiaApp.php
@@ -16,8 +16,13 @@ public function __construct()
16
17
public function run(string $cmd, $args, &$cmd_result=null): bool
18
{
19
- $cli_script = HESTIA_CMD . '/' . basename($cmd);
20
- $cli_arguments = '';
+ $cli_script = realpath(HESTIA_CMD . '/' . $cmd);
+ if(!str_starts_with((string)$cli_script, HESTIA_CMD."/" )){
21
+ $errstr = "$cmd is trying to traverse outside of " .HESTIA_CMD;
22
+ trigger_error($errstr);
23
+ throw new \Exception($errstr);
24
+ }
25
+ $cli_script = escapeshellarg($cli_script);
26
27
if (!empty($args) && is_array($args)) {
28
foreach ($args as $arg) {
0 commit comments