Skip to content
Open redirect Disclosed report Beginner

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

Informational View original
  • 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
<?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('&amp;', '&', 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

  1. Access https://blog.fuzzing-project.org/exit.php?url=aHR0cHM6Ly9nb29nbGUuY29t with a browser;
  2. Notice that the Location header 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.

The original report as published on HackerOne, by bb9866f3f743d6bf69b6836. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Access the exit.php page with a base64-encoded URL in the 'url' parameter.
  2. 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.

More by bb9866f3f743d6bf69b6836

View all

3 more disclosed reports, best first.

More from Hanno's projects

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.