Skip to content

rtsp: do not send a learned session id to another origin - #22920

Closed
MegaManSec wants to merge 1 commit into
curl:masterfrom
MegaManSec:rtsp-session-origin-check
Closed

MegaManSec wants to merge 1 commit into
curl:masterfrom
MegaManSec:rtsp-session-origin-check

Conversation

@MegaManSec

@MegaManSec MegaManSec commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

A server-issued RTSP Session: id was forwarded across a redirect to the next origin, in the same request where Authorization: is correctly stripped.

Curl_rtsp_parseheader() records the issuing origin in data->state.rtsp_session_origin, which survives redirects — the per-connection struct RTSP does not, as rtsp_setup_connection() installs a fresh one on every connection setup. rtsp_do() then suppresses Session: when the current origin differs. CURLOPT_UNRESTRICTED_AUTH is the opt-in, consistent with credentials. An id set with CURLOPT_RTSP_SESSION_ID is never flagged as learned and is forwarded unconditionally.

RFC 2326 §12.37 scopes a session identifier to one server. The CURLOPT_REDIR_PROTOCOLS_STR default already blocks RTSP redirects out of the box; this covers callers that enable them.

Test 3230 covers it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Redirect setup resets the new provenance state, so the cross-origin Session header leak remains.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds origin tracking intended to prevent learned RTSP session IDs from leaking across cross-origin redirects.

Changes:

  • Records and cleans up the session issuer’s origin.
  • Suppresses learned session IDs for mismatched origins unless unrestricted authentication is enabled.
File summaries
File Description
lib/rtsp.c Adds RTSP session-origin tracking and forwarding checks.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/rtsp.c Outdated
A Session: id issued by one server was forwarded across a redirect to
the next origin. Remember the origin that issued it and suppress the
header elsewhere, unless CURLOPT_UNRESTRICTED_AUTH is set. An id set
with CURLOPT_RTSP_SESSION_ID is unaffected.
@MegaManSec
MegaManSec force-pushed the rtsp-session-origin-check branch from da4cca3 to dddac03 Compare September 14, 2026 09:02
@github-actions github-actions Bot added the tests label Sep 14, 2026
@MegaManSec MegaManSec changed the title rtsp: suppress learned session ID on cross-origin redirect rtsp: do not send a learned session id to another origin Sep 14, 2026
@MegaManSec
MegaManSec force-pushed the rtsp-session-origin-check branch from dddac03 to d469547 Compare September 14, 2026 09:22
@bagder bagder closed this in b5c3349 Sep 17, 2026
@bagder

bagder commented Sep 17, 2026

Copy link
Copy Markdown
Member

Thanks!

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

Development

Successfully merging this pull request may close these issues.

3 participants