security: block SSRF to AWS IMDS via missing 169.254.0.0/16 in CanvasHttp blocked_ip_ranges#2636
Open
girishgupta211 wants to merge 2 commits into
Open
Conversation
|
|
The link-local CIDR block (RFC 3927) was missing from blocked_ip_ranges, allowing authenticated users to exploit the url parameter on POST /api/v1/users/self/files to reach the AWS Instance Metadata Service (169.254.169.254) and retrieve IAM credentials via SSRF.
Covers: AWS IMDS (169.254.169.254), link-local range, 10.x/172.16.x/192.168.x, DNS rebinding (mixed public+private IPs), public S3 passthrough, and validate_url check_host behaviour for all SSRF scenarios.
girishgupta211
force-pushed
the
fix/ssrf-aws-imds-url-upload
branch
from
May 28, 2026 12:57
38c0092 to
62be318
Compare
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.
Summary
The
urlparameter onPOST /api/v1/users/self/filesallows authenticated users to trigger server-side HTTP requests.CanvasHttp.blocked_ip_rangeswas missing169.254.0.0/16(RFC 3927 link-local), allowing requests to reach the AWS Instance Metadata Service (169.254.169.254) and retrieve IAM credentials.Affected file:
gems/canvas_http/lib/canvas_http.rbRoot cause:
blocked_ip_rangesdid not include the link-local CIDR block:```ruby
Before (vulnerable)
@blocked_ip_ranges || [
"127.0.0.1/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"fd00::/8"
]
After (fixed)
@blocked_ip_ranges || [
"127.0.0.1/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"169.254.0.0/16",
"fd00::/8"
]
```
Impact
Any authenticated user could POST
{"url": "http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>"}and retrieve live AWSAccessKeyId,SecretAccessKey, andTokenfrom the EC2 instance running Canvas.Test plan
POST /api/v1/users/self/fileswithurl: "http://169.254.169.254/..."now returns an error instead of fetching metadata🤖 Generated with Claude Code