Link unfurling calls out to arbitrary URLs and the private-network guard misses link-local addresses
The link unfurling endpoint fetches user-supplied URLs, but its private-network guard only blocks RFC1918 and loopback addresses, not link-local ranges. An authenticated user could therefore make the server request cloud metadata or other link-local services, potentially exposing credentials or enabling probing.
- Triaged in 2 days
- Fixed in 2 days
- Disclosed after 22 days
Summary
- /unfurl_link lets any signed-in user supply a URL that the server fetches for OpenGraph data.
- The “private network” guard only blocks RFC1918/loopback/0.0.0.0 and ignores link-local ranges, so 169.254.0.0/16 (IMDS) and fe80::/10 are treated as public.
- The unfurl fetcher then issues a server-side HTTP request to that link-local host, enabling SSRF against cloud metadata or other link-local services.
Affected Components
- app/controllers/unfurl_links_controller.rb:3-8 (accepts untrusted url and triggers metadata fetch.)
- app/models/opengraph/location.rb:25-39 (validates target via PrivateNetworkGuard.resolve and accepts link-local IPs.)
- lib/restricted_http/private_network_guard.rb:9-20 (private_ip? omits ipaddr.link_local?, so 169.254.x.x and fe80::/10 are not blocked.)
- app/models/opengraph/fetch.rb:12-74 (performs the Net::HTTP request to the resolved IP using server network context.)
Attack preconditions
- Any authenticated user (CSRF token or API client) can reach /unfurl_link.
Steps to reproduce
-
Sign in as a normal user and obtain the session/CSRF tokens.
-
Send a request such as:
curl -X POST https://<host>/unfurl_link -H "Cookie: session_token=..." -H "X-CSRF-Token: <token>" -d 'url=http://169.254.169.254/latest/meta-data/'
- Because PrivateNetworkGuard.private_ip? returns false for link-local addresses (IPAddr.new("169.254.169.254").private? #=> false while link_local? #=> true), the guard permits the target and Opengraph::Fetch issues a GET from the server to 169.254.169.254. On cloud hosts his reaches IMDS; responses with text/html would be returned, otherwise the request is still made (blind SSRF), allowing metadata probing/timing and any link-local HTML endpoints to be exfiltrated.
Evidence/References
- Guard logic lacks a link-local check, so resolve does not raise for 169.254.169.254 (lib/restricted_http/private_network_guard.rb:9-20).
- Opengraph::Location#validate_url_is_public trusts that result and proceeds to fetch (app/models/opengraph/location.rb:25-38).
- The fetcher performs the server-side request (app/models/opengraph/fetch.rb:12-74), driven directly by user input (app/controllers/unfurl_links_controller.rb:3-8).
Impact
- Authenticated users can coerce the server to reach link-local resources, including cloud metadata services (IMDS) that should be unreachable, enabling credential theft or internal service probing/timing if an HTML response is available.
Context
Campfire is a Basecamp product, and the report concerns a link unfurling feature exposed through the /unfurl_link endpoint. When a signed-in user supplies a URL, the server fetches that URL to collect OpenGraph metadata, so the response can be rendered as a preview. That design means user-controlled input reaches a server-side HTTP client, which is the classic shape of a server-side request forgery (SSRF) surface.
The report describes a guard intended to keep the fetcher away from internal networks. The guard is implemented in lib/restricted_http/private_network_guard.rb, and the fetch path runs through app/models/opengraph/location.rb and app/models/opengraph/fetch.rb. The weakness is that the guard's definition of "private" is incomplete: it blocks RFC1918 ranges, loopback and [redacted], but not link-local addresses.
Setup
The precondition is simple: any authenticated user can reach /unfurl_link. The report notes that this can be done with a CSRF token or an API client. No special role, no administrative access and no other privilege is required.
To reproduce, the researcher signed in as a normal user and obtained the session and CSRF tokens. The request is then sent with those tokens attached.
Finding it
The researcher looked at how the unfurl feature validates the target URL before fetching it. The controller at app/controllers/unfurl_links_controller.rb:3-8 accepts an untrusted url parameter and triggers the metadata fetch. app/models/opengraph/location.rb:25-39 validates the target through PrivateNetworkGuard.resolve, and app/models/opengraph/fetch.rb:12-74 performs the actual Net::HTTP request to the resolved IP using the server's network context.
The flaw sits in lib/restricted_http/private_network_guard.rb:9-20. The private_ip? method omits a check for ipaddr.link_local?. As a result, the link-local ranges [redacted]/16 and fe80::/10 are treated as public. The most interesting member of the first range is [redacted], the cloud instance metadata service (IMDS) address.
The reasoning is easy to confirm in Ruby: IPAddr.new("[redacted]").private? returns false, while link_local? returns true. A guard built only on private? therefore lets the address through.
Exploitation
Step 1: authenticate as a normal user
Sign in as an ordinary user and obtain the session and CSRF tokens. Nothing more privileged is needed.
Step 2: send the unfurl request
The researcher sends a POST to /unfurl_link with the metadata address as the url parameter:
curl -X POST https://<host>/unfurl_link -H "Cookie: session_token=..." -H "X-CSRF-Token: <token>" -d 'url=http://[redacted]/latest/meta-data/'
The Cookie header carries the authenticated session, and X-CSRF-Token satisfies the CSRF protection. The body sets url to the IMDS metadata path. Because the request is authenticated, the server treats it as a legitimate unfurl operation.
Step 3: the guard permits the target and the server fetches it
PrivateNetworkGuard.private_ip? returns false for link-local addresses, so resolve does not raise. Opengraph::Location#validate_url_is_public trusts that result and proceeds. Opengraph::Fetch then issues a GET from the server to [redacted].
On a cloud host, this reaches IMDS. If the response is text/html, it is returned to the user as unfurl data. If it is not HTML, the request is still made, which leaves a blind SSRF: the attacker can probe metadata and observe timing, and any link-local HTML endpoint can be exfiltrated through the unfurl response.
Root cause
The guard's private_ip? check in lib/restricted_http/private_network_guard.rb:9-20 covers RFC1918, loopback and [redacted], but not link-local addresses. Ruby's IPAddr#private? does not consider [redacted]/16 or fe80::/10 private, so the guard's allow decision is wrong for those ranges. The downstream code trusts the guard: Opengraph::Location#validate_url_is_public accepts the result and Opengraph::Fetch performs the request with the server's network position. The controller passes user input straight into this chain, so the missing check is the only thing standing between an authenticated user and link-local services.
Impact
An authenticated user can coerce the server into reaching link-local resources, including cloud metadata services that should be unreachable. The report states that this enables credential theft or internal service probing and timing if an HTML response is available. When the response is not HTML, the request is still issued, so the impact degrades to blind SSRF rather than disappearing. The report rates the issue as medium severity with a CVSS score of 6.7.
Fix
The report does not describe a fix that was applied. The report does not describe a fix. The gap it identifies is the missing link-local check in private_ip?, which leaves [redacted]/16 and fe80::/10 treated as public. Because Opengraph::Location and Opengraph::Fetch rely on the guard's decision, .
Variants to test
- Try other link-local forms against the same endpoint, such as IPv6
fe80::/10addresses, and check whether the guard rejects them. A positive result is a fetch attempt rather than a validation error. - A positive result is the fetcher reaching the link-local host after resolution.
- A positive result is any range the guard allows that should be internal.
- A positive result is content from the internal service appearing in the unfurl output.
Hunting notes
This kind of bug tends to hide wherever a server-side fetcher validates a user-supplied URL with a hand-written private-address check. The signal during recon is a feature that fetches URLs on the user's behalf, such as link previews, unfurling, webhooks or importers, combined with a guard whose logic is visible in the codebase or inferable from behaviour. The specific tell here is a guard built on private? alone: it looks correct at a glance but leaves link-local ranges open.
To show enough impact, the researcher tied the missing check to a concrete target, the IMDS address [redacted], and explained both the HTML case, where the response is returned, and the non-HTML case, where the request is still made and the issue becomes blind SSRF. That distinction matters: it shows the bug is exploitable even when the response cannot be read directly.
What happened, in plain words
Campfire is a product made by Basecamp. It has a feature called link unfurling: when you paste a web address into it, the server goes and fetches that page so it can show you a little preview, with the page title, an image and a short description. That is the same thing you see when you paste a link into a chat app and a card appears instead of a bare URL.
To build that preview, the server has to make an outgoing web request on your behalf. That is the important part. Normally your own browser fetches pages, and your browser sits on your computer, outside the company's internal network. Here the server fetches the page, and the server sits inside the company's network, next to other machines that are not meant to be reachable from the outside. If you can make that server fetch any address you like, you can use it as a kind of puppet to reach places you could never reach yourself. This class of bug is called server-side request forgery, or SSRF.
The developers knew about this risk, so they added a guard: a piece of code that checks the address before fetching and refuses anything that looks internal. The guard had a gap. It blocked the usual private address ranges but forgot a special range called link-local, which includes the address cloud providers use for the instance metadata service. So a normal signed-in user could ask Campfire to unfurl a link pointing at that secret address, and the server would happily go and fetch it.
The report rates this as medium severity with a CVSS score of 6.7.
Some background before the details
A few ideas come up again and again below, so here they are from scratch.
What an endpoint is. A web application is a collection of addresses, each of which does one job. /unfurl_link is one of them: it is the address the Campfire front end calls when it wants the server to fetch a link and produce a preview. Think of endpoints as counters in a shop, each with a sign above it saying what it handles.
What an API is. An API is the set of these counters, plus the rules for talking to them: which address, which method, what data to send. It is how one piece of software asks another piece of software to do something, without a human clicking anything.
What a cookie and a token are. When you sign in to a website, the server gives your browser a small piece of text called a session cookie. Your browser sends it back with every later request, and that is how the server knows it is still you and not a stranger. A CSRF token is a second, separate piece of text that the page includes so the server can tell that a request really came from the site's own pages and not from some other website trying to trick your browser. Both are secrets: anyone who has them can act as you.
What a POST request is. Browsers and programs talk to servers using HTTP methods. GET means "give me this page". POST means "here is some data, do something with it". Submitting a form is a POST.
What a header is. Extra labelled information attached to a request, alongside the address and the body. Cookie and X-CSRF-Token below are headers.
What an IP address is. A number that identifies a machine on a network, like a postal address for computers. [redacted] is one.
What a range is. A block of addresses written with a slash, such as [redacted]/16. The number after the slash says how big the block is. It is a shorthand for "all addresses from here to there".
What loopback, RFC1918 and link-local mean. Loopback is the address a machine uses to talk to itself ([redacted]). RFC1918 is the set of address ranges reserved for private networks, the ones used inside homes and offices, which are not reachable from the public internet. Link-local is another reserved set, used for machines that need to talk on a local segment without any configuration. In cloud computing, one particular link-local address, [redacted], is special: it is the instance metadata service, or IMDS, a small service that cloud providers run on every server so the server can ask "who am I, and what are my credentials?". If an outsider can make your server ask IMDS that question, the answer may come back to the outsider if the response is HTML.
What OpenGraph metadata is. A convention for putting a page's title, description and preview image into the page's HTML in a standard form, so other sites can build a nice preview card from it.
What Ruby and Net::HTTP are. Ruby is a programming language. Net::HTTP is a standard part of Ruby for making outgoing web requests. Campfire is written in Ruby, which is why the code below is Ruby.
Context
Campfire is a Basecamp product, and the report concerns a link unfurling feature exposed through the /unfurl_link endpoint. When a signed-in user supplies a URL, the server fetches that URL to collect OpenGraph metadata, so the response can be rendered as a preview. That design means user-controlled input reaches a server-side HTTP client, which is the classic shape of a server-side request forgery (SSRF) surface.
The report describes a guard intended to keep the fetcher away from internal networks. The guard is implemented in lib/restricted_http/private_network_guard.rb, and the fetch path runs through app/models/opengraph/location.rb and app/models/opengraph/fetch.rb. The weakness is that the guard's definition of "private" is incomplete: it blocks RFC1918 ranges, loopback and [redacted], but not link-local addresses.
In plain terms: the feature that builds preview cards is the door, the guard is the bouncer, and the bouncer has a list of banned addresses that is missing one important entry.
Setup
The precondition is simple: any authenticated user can reach /unfurl_link. The report notes that this can be done with a CSRF token or an API client. No special role, no administrative access and no other privilege is required.
To reproduce, the researcher signed in as a normal user and obtained the session and CSRF tokens. The request is then sent with those tokens attached.
Why this matters: a bug that only an administrator could trigger would be far less serious. Here, anyone with an ordinary account, the kind every customer has, can trigger it. That is why the researcher bothered to state it explicitly.
Finding it
The researcher looked at how the unfurl feature validates the target URL before fetching it. The controller at app/controllers/unfurl_links_controller.rb:3-8 accepts an untrusted url parameter and triggers the metadata fetch. app/models/opengraph/location.rb:25-39 validates the target through PrivateNetworkGuard.resolve, and app/models/opengraph/fetch.rb:12-74 performs the actual Net::HTTP request to the resolved IP using the server's network context.
Those file paths and line numbers are just pointers into the codebase, so a reader can find the exact lines. The flow is a chain of three links:
- The controller receives the URL the user typed. It is untrusted, because the user can type anything.
- The location model asks the guard whether the address is safe to fetch.
- The fetch model makes the actual outgoing request.
The flaw sits in lib/restricted_http/private_network_guard.rb:9-20. The private_ip? method omits a check for ipaddr.link_local?. As a result, the link-local ranges [redacted]/16 and fe80::/10 are treated as public. The most interesting member of the first range is [redacted], the cloud instance metadata service (IMDS) address.
So the bouncer's method, private_ip?, asks one question: "is this address private?" It never asks the second question: "is this address link-local?" An address that is link-local but not private gets waved through.
The reasoning is easy to confirm in Ruby: IPAddr.new("[redacted]").private? returns false, while link_local? returns true. A guard built only on private? therefore lets the address through.
IPAddr is Ruby's built-in tool for working with IP addresses. It can answer questions about an address, such as whether it is private or link-local. The snippet shows the two answers side by side: the same address is not private, but it is link-local. A guard that only checks the first answer is fooled.
Exploitation
Step 1: authenticate as a normal user
Sign in as an ordinary user and obtain the session and CSRF tokens. Nothing more privileged is needed.
Why: the endpoint only accepts requests from signed-in users, so the researcher first needs to be one. Getting the tokens is the same as logging in normally and copying the values the browser is already using.
Step 2: send the unfurl request
The researcher sends a POST to /unfurl_link with the metadata address as the url parameter:
curl -X POST https://<host>/unfurl_link -H "Cookie: session_token=..." -H "X-CSRF-Token: <token>" -d 'url=http://[redacted]/latest/meta-data/'
Line by line:
curlis a command-line tool for making web requests. It is the program equivalent of typing an address into a browser, but it lets you set every detail by hand.-X POSTsays the request method is POST, the method used for sending data.https://<host>/unfurl_linkis the address being called.<host>is a placeholder for the real Campfire host name.-H "Cookie: session_token=..."attaches the session cookie, which proves the request comes from a signed-in user. The...stands for the real value, which is a secret and is not reproduced here.-H "X-CSRF-Token: <token>"attaches the CSRF token, which proves the request came from the site's own pages rather than from a malicious third-party site.-d 'url=http://[redacted]/latest/meta-data/'is the body of the request. It sets theurlparameter to the metadata address and path. This is the value the server will fetch.
The Cookie header carries the authenticated session, and X-CSRF-Token satisfies the CSRF protection. The body sets url to the IMDS metadata path. Because the request is authenticated, the server treats it as a legitimate unfurl operation.
Why this step: the researcher is using the feature exactly as designed, but choosing the address the server will fetch. Nothing is being broken into; the server is being asked politely to fetch a page, and the page happens to be a secret internal one.
Step 3: the guard permits the target and the server fetches it
PrivateNetworkGuard.private_ip? returns false for link-local addresses, so resolve does not raise. Opengraph::Location#validate_url_is_public trusts that result and proceeds. Opengraph::Fetch then issues a GET from the server to [redacted].
"Does not raise" means the guard does not throw an error. In Ruby, raising is how a program signals that something is wrong and should stop. Because the guard says the address is fine, no error is raised, and the next step runs.
On a cloud host, this reaches IMDS. If the response is text/html, it is returned to the user as unfurl data. If it is not HTML, the request is still made, which leaves a blind SSRF: the attacker can probe metadata and observe timing, and any link-local HTML endpoint can be exfiltrated through the unfurl response.
Two outcomes, both useful to an attacker:
- The response is HTML. The unfurl feature returns HTML responses, so the content can come back to the attacker in the preview.
- The response is not HTML. The preview cannot show it, but the request still went out. The attacker can still learn things: whether the address exists, how long it takes to answer, and so on. This is called blind SSRF, because the attacker is blind to the content but not to the fact that the request happened.
Root cause
The guard's private_ip? check in lib/restricted_http/private_network_guard.rb:9-20 covers RFC1918, loopback and [redacted], but not link-local addresses. Ruby's IPAddr#private? does not consider [redacted]/16 or fe80::/10 private, so the guard's allow decision is wrong for those ranges. The downstream code trusts the guard: Opengraph::Location#validate_url_is_public accepts the result and Opengraph::Fetch performs the request with the server's network position. The controller passes user input straight into this chain, so the missing check is the only thing standing between an authenticated user and link-local services.
In everyday terms: the bouncer has a list of banned addresses, and the list is missing one entry. Everyone behind the bouncer assumes the list is complete, so nobody checks again. Fixing the list fixes the whole chain.
Impact
An authenticated user can coerce the server into reaching link-local resources, including cloud metadata services that should be unreachable. The report states that this enables credential theft or internal service probing and timing if an HTML response is available. When the response is not HTML, the request is still issued, so the impact degrades to blind SSRF rather than disappearing. The report rates the issue as medium severity with a CVSS score of 6.7.
Why credential theft is the big one: the metadata service exists to hand the server its own cloud credentials. If an attacker can read those, they can act as the server towards the cloud provider, which is a much bigger problem than reading one page.
Fix
The report does not describe a fix that was applied. The report does not describe a fix. The gap it identifies is the missing link-local check in private_ip?, which leaves [redacted]/16 and fe80::/10 treated as public. Because Opengraph::Location and Opengraph::Fetch rely on the guard's decision, .
Variants to test
These are follow-up ideas for anyone checking a similar feature elsewhere. Each one comes with what a positive result looks like, so you know whether you have found something.
- Try other link-local forms against the same endpoint, such as IPv6
fe80::/10addresses, and check whether the guard rejects them. A positive result is a fetch attempt rather than a validation error. - A positive result is the fetcher reaching the link-local host after resolution.
- A positive result is any range the guard allows that should be internal.
- A positive result is content from the internal service appearing in the unfurl output.
Hunting notes
This kind of bug tends to hide wherever a server-side fetcher validates a user-supplied URL with a hand-written private-address check. The signal during recon is a feature that fetches URLs on the user's behalf, such as link previews, unfurling, webhooks or importers, combined with a guard whose logic is visible in the codebase or inferable from behaviour. The specific tell here is a guard built on private? alone: it looks correct at a glance but leaves link-local ranges open.
Recon means the early stage of looking around a target to see what it does and where the interesting parts are. A webhook is a feature where one service calls another automatically when something happens; an importer is a feature that pulls data in from elsewhere. Both make outgoing requests, so both are candidates for the same mistake.
To show enough impact, the researcher tied the missing check to a concrete target, the IMDS address [redacted], and explained both the HTML case, where the response is returned, and the non-HTML case, where the request is still made and the issue becomes blind SSRF. That distinction matters: it shows the bug is exploitable even when the response cannot be read directly.
Glossary
- API: the set of addresses and rules one piece of software uses to ask another to do something.
- Blind SSRF: server-side request forgery where the attacker cannot read the response, but can still tell the request was made, for example from timing.
- Cookie: a small piece of text a site stores in your browser and your browser sends back with each request, used to remember who you are.
- CSRF token: a secret value included in a request to prove it came from the site's own pages, not from another site.
- CVSS: a standard scoring system for rating the severity of a security issue.
- DNS: the system that turns human-readable names into IP addresses.
- Endpoint: one address in a web application that performs one job.
- GET: an HTTP method meaning "give me this resource".
- Header: labelled extra information attached to an HTTP request or response.
- HTML: the language web pages are written in.
- HTTP: the protocol browsers and servers use to exchange requests and responses.
- IMDS (instance metadata service): a small service cloud providers run on each server, reachable at a link-local address, that gives the server information about itself including credentials.
- IP address: a number identifying a machine on a network.
- IPAddr: a Ruby class for working with IP addresses, able to answer questions such as whether an address is private or link-local.
- Link-local address: an address in a reserved range used for communication on a local network segment without configuration;
[redacted]/16for IPv4 andfe80::/10for IPv6. - Loopback: the address a machine uses to talk to itself, such as
[redacted]. - Net::HTTP: the standard Ruby library for making outgoing HTTP requests.
- OpenGraph metadata: a convention for putting a page's title, description and preview image into its HTML so other sites can build preview cards.
- POST: an HTTP method used to send data to the server.
- Private network (RFC1918): address ranges reserved for internal networks, not reachable from the public internet.
- Raise: in Ruby, to signal an error and stop the current operation.
- Recon: the early stage of exploring a target to understand what it does.
- Ruby: a programming language, the one Campfire is written in.
- Server-side request forgery (SSRF): a bug where an attacker can make a server send a request to an address of the attacker's choosing.
- Session token: the value inside a session cookie that identifies a signed-in user.
- Unfurling: a feature that fetches a pasted link and builds a preview card from it.
- Webhook: an automatic request one service sends to another when an event happens.