Skip to content

Commit 3d4c309

Browse files
divinity76jaapmarcus
authored andcommitted
fix DokuWiki shell issue
UNTESTED as of writing; reported by https://huntr.dev/users/redstarp2/
1 parent 67a57a6 commit 3d4c309

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

web/src/app/WebApp/Installers/DokuWiki/DokuWikiSetup.php

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,28 @@ public function install(array $options = null, &$status=null)
8080

8181
$installUrl = $webDomain . "install.php";
8282

83-
$cmd = "curl --request POST "
84-
. ($sslEnabled ? "" : "--insecure " )
85-
. "--url $installUrl "
86-
. "--header 'Content-Type: application/x-www-form-urlencoded' "
87-
. "--data l=en "
88-
. "--data 'd[title]=" . $options['wiki_name'] . "' "
89-
. "--data 'd[acl]=on' "
90-
. "--data 'd[superuser]=" . $options['superuser'] . "' "
91-
. "--data 'd[fullname]=" . $options['real_name'] . "' "
92-
. "--data 'd[email]=" . $options['email'] . "' "
93-
. "--data 'd[password]=" . $options['password'] . "' "
94-
. "--data 'd[confirm]=" . $options['password'] . "' "
95-
. "--data 'd[policy]=" . substr($options['initial_ACL_policy'], 0, 1) . "' "
96-
. "--data 'd[license]=" . explode(":", $options['content_license'])[0] . "' "
97-
. "--data submit=";
83+
$cmd = implode(" ", array(
84+
"curl",
85+
"--request POST",
86+
($sslEnabled ? "" : "--insecure "),
87+
"--url " . escapeshellarg($installUrl),
88+
"--header 'Content-Type: application/x-www-form-urlencoded'",
89+
'--data-binary ' . escapeshellarg(http_build_query(array(
90+
"l" => "en",
91+
"d" => array(
92+
"title" => $options['wiki_name'],
93+
'acl' => 'on',
94+
'superuser' => $options['superuser'],
95+
'fullname' => $options['real_name'],
96+
'email' => $options['email'],
97+
'password' => $options['password'],
98+
'confirm' => $options['password'],
99+
'policy' => substr($options['initial_ACL_policy'], 0, 1),
100+
'license' => explode(":", $options['content_license'])[0]
101+
),
102+
'submit' => ''
103+
)))
104+
));
98105

99106
exec($cmd, $output, $return_var);
100107
if($return_var > 0){

0 commit comments

Comments
 (0)