Skip to content

Skip requests for usernames that produce an invalid host URL (#2970) - #3141

Open
csjad wants to merge 1 commit into
sherlock-project:masterfrom
csjad:fix/username-trailing-dot-crash-2970
Open

csjad wants to merge 1 commit into
sherlock-project:masterfrom
csjad:fix/username-trailing-dot-crash-2970

Conversation

@csjad

@csjad csjad commented Sep 19, 2026

Copy link
Copy Markdown

Summary

Fixes #2970.

A username ending in . (e.g. alice.) combined with a subdomain template such as https://{username}.example.com produces an invalid interpolated URL https://alice..example.com. The request layer raises on the malformed host and aborts the entire run, so one bad username kills discovery for every other site.

Root cause

sites entries whose url contains {username} are interpolated before any host validation. urlparse then yields a host with consecutive dots (..) or a leading dot, and the HTTP client raises while building the request.

Fix

Before the regex/username check, validate the interpolated host with urlparse:

  • empty netloc, or
  • .. in netloc, or
  • netloc starting with .

→ mark the site ILLEGAL and skip it instead of crashing the run.

Test

Added tests/subdomain_username_test.py (regression):

  • trailing-dot username → ILLEGAL
  • leading-dot username → ILLEGAL
  • normal username → not flagged by the host check

Files

  • sherlock_project/sherlock.py
  • tests/subdomain_username_test.py

…k-project#2970)

A username ending in '.' combined with a subdomain-style site template
(e.g. https://{username}.example.com) interpolates to an invalid URL such as
https://alice..example.com, whose request raises and aborts the whole run.

Validate the interpolated host with urlparse and report the site as ILLEGAL
instead of crashing. Path-style templates (https://example.com/alice.) and
valid FQDN usernames are unaffected.

Fixes sherlock-project#2970
@csjad
csjad requested a review from ppfeister as a code owner September 19, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashes when handling usernames ending in period (.)

1 participant