Open redirect in Serendipity (exit.php)
The exit.php script in Serendipity redirects users to a URL supplied in the 'url' parameter after base64 decoding, without validating the hostname. An attacker can craft a link that redirects victims to an arbitrary site.
bb9866f3f743d6bf69b6836 Follow
Originally disclosed on HackerOne
- Disclosed after 4 months
Summary
Serendipity contains a script named exit.php that can be directly accessed. When crafting an hyperlink pointing to this page with the parameter url containing a base64-encoded URL, it will redirect the user to this URL.
## Description
The file exit.php contains the following code:
<?php
// [...]
if (isset($_GET['url_id']) && !empty($_GET['url_id']) && isset($_GET['entry_id']) && !empty($_GET['entry_id'])) {
// [...]
} elseif (isset($_GET['url']) && !empty($_GET['url'])) {
// No entry-link ID was submitted. Possibly a spammer tried to mis-use the script to get into the top-list.
$url = strip_tags(str_replace('&', '&', base64_decode($_GET['url'])));
}
if (serendipity_isResponseClean($url)) {
header('HTTP/1.0 301 Moved Permanently');
header('Status: 301 Moved Permanently');
header('Location: ' . $url);
}
The interesting part is the handling of $_GET['url']. The function serendipity_isResponseClean() tries to prevent response splitting issues but does not validate the hostname of the URL where the user is redirected to.
Steps To Reproduce
- Access https://blog.fuzzing-project.org/exit.php?url=aHR0cHM6Ly9nb29nbGUuY29t with a browser;
- Notice that the
Locationheader of the response contains an arbitrary URL (here, https://google.com).
Impact
An attacker can craft an hyperlink pointing to https://blog.fuzzing-project.org that, once accessed, will redirect the victim to an arbitrary URL.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The script decodes a user-supplied URL and uses it in a Location header without validating the destination hostname.
Impact
An attacker can craft a hyperlink that, once accessed, will redirect the victim to an arbitrary URL.
What the attacker needed
Victim clicks a crafted link
How it was found
- Access the exit.php page with a base64-encoded URL in the 'url' parameter.
- Observe that the Location header contains the decoded arbitrary URL.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
An open redirect is a flaw where a site sends you to another site based on a link you click. Here, the site takes a web address from the link and forwards you there without checking the hostname.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.