Escape spreadsheet formulas when exporting visits as CSV - #2665
Closed
matheuscabral-appx wants to merge 2 commits into
Closed
matheuscabral-appx wants to merge 2 commits into
matheuscabral-appx wants to merge 2 commits into
Conversation
User-Agent and Referer are set by whoever visits a short URL, and were written verbatim to the CSV produced by the visits commands, so values starting with =, -, +, @, tab or CR were evaluated as formulas when the file was opened in a spreadsheet (CVE-2026-18738). Enable league/csv's EscapeFormula formatter, which prefixes those values with a single quote. All visits commands render CSV through VisitsCommandUtils::renderOutput, so this covers short-url:visits, domain:visits, tag:visits, visit:orphan and visit:non-orphan. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This comment was marked as off-topic.
This comment was marked as off-topic.
Author
|
Can you just consider the fix for the future? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User-AgentandRefererare stored verbatim and written as-is by the--format=csvvisitcommands. A value starting with
=,-,+or@is interpreted as a formula by Excel andGoogle Sheets, so a visitor can plant one with no authentication and it runs on the machine of
whoever opens the export. In Google Sheets,
IMPORTXML/IMPORTDATAfetch without any userinteraction.
This is CVE-2026-18738, which is already public. I'm opening a PR rather than a report because
there is nothing left to disclose and
SECURITY.mdasks not to file public issues.league/csvalready shipsEscapeFormulafor exactly this, so the fix is enabling it inVisitsCommandUtils::renderCSVOutput:No new dependency, no behaviour change for ordinary values.
Before:
After:
This covers every visit command, since they all go through
VisitsCommandUtils::renderOutput:short-url:visits,domain:visits,tag:visits,visit:orphanandvisit:non-orphan.Verified against 5.1.7 by planting the payloads through a real visit and exporting; a normal
Mozilla/5.0value comes out untouched. Test included.