Details
Option 2: Restrict installer to localhost/CLI only
Block web access to the installer entirely:
// At the top of install/checkConfiguration.php, after the file_exists check:
if (!isCommandLineInterface()) {
$allowedIPs = ['127.0.0.1', '::1'];
if (!in_array($_SERVER['REMOTE_ADDR'], $allowedIPs)) {
header('Content-Type: application/json');
echo json_encode(['error' => 'Installation is only allowed from localhost']);
exit;
}
}
Additionally, add an .htaccess file in the install/ directory:
# install/.htaccess
<Files "checkConfiguration.php">
Require local
</Files>
Additional fixes needed
- Parameterize SQL queries on line 120 to prevent SQL injection:
$stmt = $mysqli->prepare("INSERT INTO users (id, user, email, password, created, modified, isAdmin) VALUES (1, 'admin', ?, ?, now(), now(), true)");
$hashedPass = md5($_POST['systemAdminPass']); // Also: upgrade from md5 to password_hash()
$stmt->bind_param("ss", $_POST['contactEmail'], $hashedPass);
$stmt->execute();
- Upgrade password hashing from
md5()topassword_hash()withPASSWORD_BCRYPTorPASSWORD_ARGON2ID.
Credit
This vulnerability was discovered and reported by bugbunny.ai.