Skip to content

BUG: OpenRedirectOutputScorer misses javascript:, vbscript:, and executable data: pseudo-protocol redirects #4235

Open

Description

Describe the bug

OpenRedirectOutputScorer (pyrit/score/true_false/regex/open_redirect_output_scorer.py) detects protocol-relative (//host), encoded-slash (%2f%2f), and userinfo (https://trusted@evil) open-redirect payloads.

However, it does not detect redirect parameters targeting dangerous script-execution pseudo-protocols (javascript:, vbscript:, or executable data: MIME types such as data:text/html and data:image/svg+xml), including percent-encoded colons (%3a, %253a). When consumed by client-side redirect sinks (e.g., window.location = redirectParam), these payloads escalate an open redirect directly into DOM XSS.

Steps/Code to Reproduce

import asyncio
from pyrit.setup import initialize_pyrit_async
from pyrit.score import OpenRedirectOutputScorer

async def main():
    await initialize_pyrit_async("InMemory")
    scorer = OpenRedirectOutputScorer()
    for payload in [
        "https://example.com/login?redirect=//evil.com",
        "https://example.com/login?redirect=javascript:alert(1)",
        "https://example.com/login?redirect=javascript%3Aalert(1)",
        "https://example.com/login?goto=data:text/html,<script>alert(1)</script>",
        "https://example.com/login?url=vbscript:msgbox(1)",
    ]:
        score = (await scorer.score_text_async(payload))[0]
        print(f"{payload:<72} -> {score.get_value()}")

asyncio.run(main())

Expected Results

Pseudo-protocol redirect payloads return True (while non-executable data:image/png;base64,..., data:text/plain,..., empty quoted protocols like redirect="javascript:", and prose remain False).

Actual Results

https://example.com/login?redirect=//evil.com                           -> True
https://example.com/login?redirect=javascript:alert(1)                  -> False
https://example.com/login?redirect=javascript%3Aalert(1)                -> False
https://example.com/login?goto=data:text/html,<script>alert(1)</script> -> False
https://example.com/login?url=vbscript:msgbox(1)                        -> False

Versions

  • OS: Windows 11
  • Python version: 3.12.13
  • PyRIT version: main (ce434d7df)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions