Merge pull request #1333 from RaspAP/security/wpa_cli

Input sanitization for wpa client
This commit is contained in:
Bill Zimmerman 2023-04-07 10:39:52 +00:00 committed by GitHub
commit f17cb126fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,11 +18,9 @@ function DisplayWPAConfig()
if (isset($_POST['connect'])) { if (isset($_POST['connect'])) {
$result = 0; $result = 0;
$iface = escapeshellarg($_SESSION['wifi_client_interface']); $iface = escapeshellarg($_SESSION['wifi_client_interface']);
$netid = escapeshellarg(strval($_POST['connect'])); $netid = intval($_POST['connect']);
if (is_numeric($netid)) {
exec('sudo wpa_cli -i ' . $iface . ' select_network ' . $netid); exec('sudo wpa_cli -i ' . $iface . ' select_network ' . $netid);
$status->addMessage('New network selected', 'success'); $status->addMessage('New network selected', 'success');
}
} elseif (isset($_POST['wpa_reinit'])) { } elseif (isset($_POST['wpa_reinit'])) {
$status->addMessage('Reinitializing wpa_supplicant', 'info', false); $status->addMessage('Reinitializing wpa_supplicant', 'info', false);
$force_remove = true; $force_remove = true;