crowdsec: request-shape — generate traversal spellings, extend the path families (card #1977) #2942
No reviewers
Labels
No labels
backlog
bug
enhancement
in-progress
library
needs-rebase
review
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ymrtech/nix-config!2942
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "kb/crowdsec-shape-normalise"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Card: https://board.ymrtech.com/?controller=TaskViewController&action=show&task_id=1977
What this changes
fleet/http-request-shape(the one real-endpoint detection that is exempt from CrowdSec's simulation flag onpublic) matched 37.8% of one recorded campaign's requests: source136.117.218.174, 2026-11-16..21, 3,300 requests across five real vhosts, 33 rotating spoofed crawler user-agents, 233422s and 179200s. Two structural causes, both fixed here inhosts/common/optional/crowdsec.nix:1. Traversal cannot be enumerated by hand. The scenario matches Caddy's raw
request.uri(evt.Parsed.request) and the expression language has no percent-decoder, so..%2Fis a different string from../. The list carried"/../"and"%2e%2e"; the campaign walked past with..%2F(14 rows onstagealone),.%2e/,..%5Cand%2e%2e%2f. Replaced the two literals with a generatedtraversalTokens: every spelling of two dots then a separator over a closed alphabet — a dot is./%2e/ overlong%c0%ae, a separator is//%2f/%5c— each also double-encoded (%25), because a proxy that decodes once hands the origin a second layer. 30 tokens; no spelling of the class can be missing.2. The families a modern deployment leaks were absent: php probe + php-cgi argument injection, Laravel/Symfony internals, CI/deploy config, credential stores, IaC state, build manifests, model-gateway endpoints (
/api/v1/models,/.litellm/,/.config/openai/), LFI sinks (/proc/self/,/fileview?file=,/fs/read?allowoutsideworkspace) and debug handlers.Measured (scripts/crowdsec-shape-replay.py, added here)
GET /api/v1/settings/apiongit.ymrtech.com— a scanner URI, not a served route.11.0.0.8over 7 days (/api/login,/api/devices/*,/account/verify— none matches a token).Deliberately not added
Each of these is a filename a real service serves, measured against the fleet's own 2xx/3xx traffic:
/docker-compose./openapi.json/ymrtech/ymrtech/src/branch/main/openapi.json/wp-config./settings.py/swagger,/swagger-ui/assets/js/swagger-ui.*.js,/swagger.v1.json/config.json/api/config,/api/settingsThis is the price of the code host and the app vhosts sharing one
fqdnslist: filename-shaped tokens are unsafe, path-shaped tokens are safe. Documented in the option description so the next person does not re-add them.What remains uncovered, and why it needs a different mechanism
971 of 3,300 (29%) still miss. They are almost all frontend route guessing —
/pricing,/settings/billing,/dashboard,/login,/billing— which no path list can take without collateral risk (a real page could legitimately live at/pricing). The recorded campaign sent ~40 such probes per minute; the discriminator there is volume from one source, not path shape.That escalation is not in this PR on purpose: the published page
services/security/perimeter.mdstates "only the deception profile is enabled", and adding a ban profile for this scenario makes that sentence false. It is an owner decision (ban-on-volume from the shape rule, plus the copy change), recorded on card #1977.Verification
nix evalclean forpublic,mail,vpn; 231 unique tokens, no duplicates.maxUriLengthand the method list.requestShape.fqdns.foremerge intent coverage (advisory) — 2 of 2 changed path(s) in ymrtech/nix-config#2942 have no live foremerge intent:
hosts/common/optional/crowdsec.nixscripts/crowdsec-shape-replay.pyCoverage was decided by reading the repo's foremerge ledger (14 in-flight intent(s) considered) against this PR's changed paths — no branch or session name is involved, so a force-push does not change the answer. Paths that legitimately need no claim (docs,
.md,flake.lock) are excluded.This is advisory and does not block the merge. To clear it, publish intent for the paths above (
foremerge intent publish --agent <your agent id> --task <task> --summary <what and why> --scope file:<path>=modify), or ignore it if the work genuinely collides with nobody.2894742824f31d717436