Skip to content
Open redirect Write-up Intermediate

Bypassing open redirect protection site-wide on web2py applications

The web2py framework's built-in open redirect protection used a regex that failed to match URLs with a single slash after the scheme, so an attacker could craft a URL that bypassed the check and redirected users to an arbitrary external site. In the example application, this affected the admin login redirect, allowing an attacker to send a crafted link that would redirect the admin to a malicious site after login.

Mohamed Dief Follow

Published on web.archive.org

Web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications, mainly used for creating web-applications in python with built-in structure

Mohamed Dief (@DemoniaSlash), on web.archive.org

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The open redirect protection relied on a regex that did not account for URLs with a single slash after the scheme, which browsers still interpret as absolute URLs.

Impact

An attacker could redirect users, including administrators after login, to an arbitrary external site, which could be used for phishing or further attacks.

What the attacker needed

Victim clicks a crafted link; application uses vulnerable web2py version; redirect parameter is used (e.g., admin login)

The fix

The web2py team replaced the regex-based protection with Python's urlparse library, and users should upgrade to the fixed version.

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 write-up has not been written yet. The Original tab links to the source.

Open redirect is when a website takes a user-supplied address and sends the user there without checking it is safe. Here, the check used a pattern (regex) that missed a slightly unusual but still valid web address, so an attacker could make the site send people to a harmful page. The fix was to use a proper URL parser instead of a pattern.

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.

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.