Skip to content

Comments

fix(radar): prevent path traversal in tool parameters#278

Merged
andre-j3sus merged 2 commits intomainfrom
ajesus/radar
Jan 15, 2026
Merged

fix(radar): prevent path traversal in tool parameters#278
andre-j3sus merged 2 commits intomainfrom
ajesus/radar

Conversation

@andre-j3sus
Copy link
Collaborator

Add strict input validation to prevent path traversal attacks in Radar MCP server tools. The vulnerability allowed attackers to escape the /radar/ API scope and access other Cloudflare API endpoints using the victim's token.

Changes:

  • Add SlugParam validator (alphanumeric only) for bot and CT log slugs
  • Add Sha256FingerprintParam validator (64 hex chars) for CA identifiers
  • Add numeric regex validation to GeoIdParam for GeoNames IDs
  • Add defense-in-depth check in fetchRadarApi to reject '..' and '//'

Affected tools:

  • get_bot_details: botSlug now validated with SlugParam
  • get_geolocation_details: geoId now validated as numeric string
  • get_ct_authority_details: caSlug now validated as SHA256 fingerprint
  • get_ct_log_details: logSlug now validated with SlugParam

@devandrepascoa
Copy link

lgtm

@andre-j3sus andre-j3sus marked this pull request as ready for review January 13, 2026 11:33
Add strict input validation to prevent path traversal attacks in Radar MCP
server tools. The vulnerability allowed attackers to escape the /radar/ API
scope and access other Cloudflare API endpoints using the victim's token.

Changes:
- Add SlugParam validator (alphanumeric only) for bot and CT log slugs
- Add Sha256FingerprintParam validator (64 hex chars) for CA identifiers
- Add numeric regex validation to GeoIdParam for GeoNames IDs
- Add defense-in-depth check in fetchRadarApi to reject '..' and '//'

Affected tools:
- get_bot_details: botSlug now validated with SlugParam
- get_geolocation_details: geoId now validated as numeric string
- get_ct_authority_details: caSlug now validated as SHA256 fingerprint
- get_ct_log_details: logSlug now validated with SlugParam
Replace blocklist pattern matching with URL path normalization and
allowlist validation. The URL constructor normalizes paths (resolves
'..' and decodes percent-encoding), so we verify the final pathname
stays within /client/v4/radar/ scope.

This approach handles:
- URL-encoded traversal attempts (%2e%2e, %2f)
- Double encoding and other bypass techniques
- Future unknown bypass patterns (allowlist vs blocklist)
@andre-j3sus andre-j3sus merged commit eb24e3b into main Jan 15, 2026
6 checks passed
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.

3 participants