Skip to content

fix OSSL_parse_url userinfo scan to respect authority boundary - #30319

Closed
1seal wants to merge 1 commit into
openssl:masterfrom
1seal:codex/openssl-parse-url-authority
Closed

1seal wants to merge 1 commit into
openssl:masterfrom
1seal:codex/openssl-parse-url-authority

Conversation

@1seal

@1seal 1seal commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

PR description (for github.com/openssl/openssl)

title

fix OSSL_parse_url userinfo scan to respect authority boundary

body

OSSL_parse_url() uses strchr(p, '@') to locate the userinfo delimiter, but this scans the entire remaining URL string rather than only the authority component. per RFC 3986, the authority ends at the first /, ?, or #. an @ in the path, query, or fragment should not be interpreted as a userinfo delimiter.

this matters for callers that use the extracted host for security decisions, such as nc_uri() in crypto/x509/v3_ncons.c (URI nameConstraints matching during certificate verification).

the fix bounds the @ search to the authority component using memchr over the authority length (delimited by strpbrk(p, "/?#")).

example:

  • input: https://victim.com/[email protected]
  • before: extracted host = attacker.com (wrong, @ is in the path)
  • after: extracted host = victim.com (correct, @ outside authority is ignored)

includes regression test covering @ in path, query, and fragment positions.

@t8m t8m added branch: master Applies to master branch triaged: bug The issue/pr is/fixes a bug branch: 3.0 Applies to openssl-3.0 branch (EOL) tests: present The PR has suitable tests present branch: 3.3 Applies to openssl-3.3 (EOL) branch: 3.4 Applies to openssl-3.4 branch: 3.5 Applies to openssl-3.5 branch: 3.6 Applies to openssl-3.6 approval: review pending This pull request needs review by a committer labels Mar 9, 2026
@t8m t8m closed this Mar 9, 2026
@t8m t8m reopened this Mar 9, 2026
@openssl-machine openssl-machine added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Mar 10, 2026
@esyr esyr added the branch: 4.0 Applies to openssl-4.0 label Mar 10, 2026
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Mar 11, 2026
@openssl-machine

Copy link
Copy Markdown
Collaborator

This pull request is ready to merge

openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)
openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)

(cherry picked from commit 7aedbb3)
openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)

(cherry picked from commit 7aedbb3)
openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)

(cherry picked from commit 7aedbb3)
openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)

(cherry picked from commit 7aedbb3)
openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)

(cherry picked from commit 7aedbb3)
openssl-machine pushed a commit that referenced this pull request Mar 11, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from #30319)

(cherry picked from commit 7aedbb3)
@t8m

t8m commented Mar 11, 2026

Copy link
Copy Markdown
Member

Merged to all the active branches. Thank you for your contribution.

rickyringler pushed a commit to rickyringler/openssl that referenced this pull request Aug 21, 2026
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from openssl#30319)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch branch: 3.0 Applies to openssl-3.0 branch (EOL) branch: 3.3 Applies to openssl-3.3 (EOL) branch: 3.4 Applies to openssl-3.4 branch: 3.5 Applies to openssl-3.5 branch: 3.6 Applies to openssl-3.6 branch: 4.0 Applies to openssl-4.0 tests: present The PR has suitable tests present triaged: bug The issue/pr is/fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants