Skip to content

Commit 7e2c2f4

Browse files
lscharmerfwolf-ilias
authored andcommitted
SAML: Open redirect on logout
Signed-off-by: Releasemanager <webmaster@ilias.de>
1 parent 63839f6 commit 7e2c2f4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Services/Init/classes/class.ilStartUpGUI.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,17 @@ private function doSamlAuthentication(): void
18141814
if (isset($params['action']) && $params['action'] === 'logout') {
18151815
$logout_url = $params['logout_url'] ?? '';
18161816
$this->logger->info(sprintf('Requested SAML logout: %s', $logout_url));
1817+
$host = fn($url) => parse_url($url ?: '', PHP_URL_HOST);
1818+
1819+
// Invalid URL's will be catched by this too ($host($logout_url) is null but not in array).
1820+
if (!in_array($host($logout_url), array_filter([
1821+
'localhost',
1822+
$host($this->dic->iliasIni()->readVariable('server', 'http_path')),
1823+
$host($this->dic->settings()->get('soap_wsdl_path')),
1824+
]), true)) {
1825+
throw new Exception('Redirect URL not allowed');
1826+
}
1827+
18171828
$auth->logout($logout_url);
18181829
}
18191830

0 commit comments

Comments
 (0)