Sherlock 0.16.2 Writes Reports Outside Its Folder on a ../ Username
Software / news
Sherlock 0.16.2 Writes Reports Outside Its Folder on a ../ Username
Two unmerged pull requests would fix the bug, and the last two gaps between Sherlock releases were 435 and 359 days.
Sherlock 0.16.2, the latest release of the 107,476-star username-search tool, builds its report filename straight from the username you type, so a username such as ../poc_escape writes the file one directory above the output folder. A reporter filed the bug as issue 3207 on Nov. 9, and two competing fixes were still open on Nov. 10.
What the reporter showed
Sherlock is an MIT-licensed command-line tool that checks one username against more than 400 social networks and saves the hits to a text file named after the username, according to the project README. The reporter, who files under the handle Luwcj, says the --txt, --csv and --xlsx output branches in main() join the username into a filename without sanitizing it.
A username containing ../, ..\, / or \ therefore climbs out of the directory set with --folderoutput. The reporter ran Sherlock with the username ../poc_escape and --folderoutput ./out. The out folder stayed empty and the results file appeared one level up. The report was verified on Windows with Python 3.14, and the reporter says the logic does not depend on the operating system.
The reporter rates it Low severity and files it under CWE-22, the standard label for path traversal. The risk the reporter names is to wrappers that pass untrusted usernames into Sherlock: Docker images, CI scripts and bots. Against those, an attacker could create or overwrite files ending in .txt, .csv or .xlsx outside the intended folder. A person typing their own username at a terminal is not the exposure.
The reporter also flags a separate possible CSV formula-injection problem, with no detail in the issue about how it would be triggered.
Two fixes, neither merged
Pull request 3211, opened Nov. 9 at 11:20 UTC by a contributor named 0xABCD01, adds a safe_result_filename() helper. It reduces a username to one filename component, treats both slashes as separators on every platform, and rejects empty names, ., .., trailing separators and NUL characters. The change touches 2 files with 225 additions and 4 deletions, and ships 20 tests, of which the author says 18 fail on the current master branch.
The author notes that the fix collapses ../poc and poc into the same filename. The PR also says xlsx output ignores --folderoutput altogether, a separate problem tracked in issue 3115 and left out of scope.
PR 3211 is an alternative to PR 3209, which takes a similar approach. The 3211 author offers to close theirs if the maintainers prefer 3209. GitHub lists ppfeister as a requested reviewer on 3211, and the pull request was not merged when we read it.
Release cadence matters here
The fix cannot reach pipx or pip users until a release carries it. The PyPI listing shows how rarely that happens.
| Release | Date | Gap from previous |
|---|---|---|
| 0.14.3 | May 13, 2024 | n/a |
| 0.14.4 | May 26, 2024 | 13 days |
| 0.15.0 | Jul 8, 2024 | 43 days |
| 0.16.0 | Sep 16, 2025 | 435 days |
| 0.16.2 | Sep 10, 2026 | 359 days |
PyPI lists 0.16.2 as the newest version, published Sept. 10, 2026, and the README's Docker line (docker run -it --rm sherlock/sherlock) is one of the install routes the reporter has in mind. The repository itself is busy: it had 402 open issues and pull requests on Nov. 10, and the same day brought a new --json-output pull request and a proposal for opt-in manual checks on Xiaohongshu and Douyin.
What to do before a release
Anyone who calls Sherlock with usernames they did not type themselves can validate the string first. Rejecting any username containing a slash or backslash blocks the reported case without waiting for the maintainers. The issue had zero comments and no maintainer reply when read, so no patched version number or date exists yet.
The one concrete date to watch is the first release after 0.16.2: the two previous gaps were 435 and 359 days, and neither open fix has merged.
Related: Psalm 7 turned on taint analysis by default for PHP, and Meta's Astryx is another repository that climbed GitHub fast.
Sources
More in Software
- 01Git Contributors Draft a Debian-Style Vote on Whether to Keep the Ban on AI-Looking PatchesThe project has not agreed who may vote, how ballots are counted or what the options are, and the policy under dispute rejects any patch that looks AI generated.
- 02.NET 11 Ships With C# 15 Union Types, the Same Day .NET 8 and 9 Lose SupportMicrosoft's release is a two-year Standard Term Support build whose end-of-support date matches .NET 10's, which changes the upgrade maths for teams still on .NET 8.
- 03Agent Skills: Why Matt Pocock's 27-Skill Repo Has More Stars Than Anthropic'sBoth repositories are on GitHub trending. They share one file format, differ in intent, and one of them tells you in its README not to rely on it.
- 04Rust Pointer Provenance: What addr(), with_addr() and Miri Change About as usizeA Nov. 2 post and the standard library docs show what a pointer-to-integer cast throws away, and the Rust APIs that avoid it.