Lack of URL normalization renders Blocked-Previews feature ineffectual
Slack's Blocked Previews feature did not normalise URLs before checking them against the blocklist, so attackers could bypass the blocklist by adding a trailing period to the host or using path traversal segments. This allowed link previews to appear even when workspace admins had blocked them.
Originally disclosed on HackerOne
- Triaged in 4 days
- Fixed in 9 months
- Paid in 2 months
- Disclosed after 11 months
Slack has a feature known as Blocked Previews, which allows Workspace Owners and Admins to specify a list of URLs for which no link preview should occur. The point of this feature is to reduce clutter and prevent harmful content from getting embedded in the workspace.
However, when a URL is posted on Slack, the backend evidently doesn't perform any preliminary URL normalization on it. This lack of URL normalization enables easy bypasses of a workspace's list of blocked previews.
(In what follows, I'll use the link https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/ as an example.)
Bypassing blocked previews for all links from a domain
If all previews from jub0bs.com have been blocked, posting https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/ (note the trailing period after the host part) will trigger a link preview. Note: posting such a URL to Slack requires an intercepting proxy, such as Burp. Here is a video PoC:
Bypassing Blocked Previews for a specific link or all links under a domain subdirectory
If previews for
- specific link
https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/, or - all links under
jub0bs.com/posts
have been blocked, posting a URL of the form https://jub0bs.com/ARBITRARY_PATH_SEGMENT/../posts/2021-01-29-great-samesite-confusion/ (note the non-normalized path) will trigger a link preview. Here is a video PoC:
Impact
Workspace Owners and Admins cannot easily block link previews in a reliable fashion. The trailing-period bypass requires them to duplicate create an additional rule for each blocked domain, and the path-normalization bypass completely defeats the blocking of specific links or all links under a domain subdirectory. As a result, malicious actors are able to get their links to preview in Slack regardless of the workspace's list of blocked previews.
Please note that the "attack" scenario isn't limited to "team member against team member", because links may come from Slack integrations (e.g. with Microsoft Outlook). In this connection, see report #481472.
Context
Slack has a feature called Blocked Previews, which lets Workspace Owners and Admins specify a list of URLs for which no link preview should occur. The stated purpose of the feature is to reduce clutter and to prevent harmful content from getting embedded in the workspace.
The behaviour under examination is what happens when a URL is posted on Slack. The backend evidently does not perform any preliminary URL normalization on the posted URL before checking it against the workspace's list of blocked previews. That absence of normalization is what makes the feature easy to bypass.
Throughout the report the link https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/ is used as the example.
Setup
Two preconditions matter for the bypasses described below:
- The workspace has entries in its Blocked Previews list: either a whole domain, a specific link, or all links under a domain subdirectory.
- For the trailing-period bypass, posting the crafted URL to Slack requires an intercepting proxy, such as Burp. The report does not describe any other tooling, account roles or versions.
Finding it
The researcher observed that when a URL is posted, the backend compares it against the blocked list without first normalizing it. Two consequences follow from that: a URL that is semantically the same as a blocked one can differ textually, and a URL whose path is not normalised can resolve to a blocked resource while not matching the blocked entry.
Exploitation
Step 1: bypass a blocked domain with a trailing period
If all previews from jub0bs.com have been blocked, posting the following URL (note the trailing period after the host part) will still trigger a link preview:
https://jub0bs.com./posts/2021-01-29-great-samesite-confusion/
Posting the URL with the trailing period triggers a link preview despite the domain being blocked. Because Slack's client does not let you post such a URL directly, the request has to be sent through an intercepting proxy such as Burp.
Step 2: bypass a blocked specific link or subdirectory with a non-normalised path
If previews for the specific link https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/ have been blocked, or if all links under jub0bs.com/posts have been blocked, posting a URL of the following form (note the non-normalised path) will trigger a link preview:
https://jub0bs.com/ARBITRARY_PATH_SEGMENT/../posts/2021-01-29-great-samesite-confusion/
Posting a URL of this form, with the non-normalised path, triggers a link preview.
Root cause
The backend does not normalise the posted URL before comparing it against the workspace's Blocked Previews list. Because no normalization is performed, a trailing period on the host or a .. segment in the path changes the string without changing the resource. Because the URL is not normalised, both the domain rule and the link or subdirectory rule can be bypassed.
Impact
Workspace Owners and Admins cannot easily block link previews in a reliable fashion. The trailing-period bypass requires them to create an additional rule for each blocked domain, and the path-normalization bypass completely defeats the blocking of specific links or of all links under a domain subdirectory. As a result, malicious actors are able to get their links to preview in Slack regardless of the workspace's list of blocked previews.
The attack scenario is not limited to team member against team member, because links may also come from Slack integrations, for example the integration with Microsoft Outlook.
Fix
The report does not describe any fix or remediation.
Variants to test
- Trailing period on the host of a blocked domain, as in
https://jub0bs.com./posts/2021-01-29-great-samesite-confusion/. A positive result is a preview appearing for a domain that is on the blocked list. - An arbitrary path segment followed by
..before the blocked path, as inhttps://jub0bs.com/ARBITRARY_PATH_SEGMENT/../posts/2021-01-29-great-samesite-confusion/. A positive result is a preview appearing for a blocked specific link or for a link under a blocked subdirectory.
Hunting notes
This kind of bug hides in features that compare user-supplied URLs against a list, such as preview blocking, link allowlists and denylists, and redirect validation. The signal is a blocklist check that appears to operate on the raw string rather than on a normalised URL. To demonstrate impact, show that a URL which is textually different from a blocked entry but resolves to the same resource still produces the blocked behaviour (here, a preview), and cover both the domain-level rule and the link or subdirectory-level rule, since the two bypasses are distinct.
What happened, in plain words
Slack is a messaging app that teams use to talk to each other. When someone pastes a web address (a URL) into a Slack message, Slack often shows a small preview of that page underneath the message: a title, a picture, a short description. This is convenient, but it can also be unwanted. A workspace (a team's Slack account) can therefore keep a list of web addresses for which no preview should ever appear. Slack calls this feature Blocked Previews, and Workspace Owners and Admins are the people who manage that list.
The idea behind Blocked Previews is simple: keep the chat tidy, and stop harmful content from being embedded in the workspace. The researcher found that this feature is easy to get around. When a URL is posted, Slack's backend (the servers behind the app) checks it against the blocked list, but it does so without first cleaning the URL up into a standard form. Security people call that cleaning-up step URL normalization. Because the URL is not normalised first, a slightly different-looking URL that points to the same page slips past the block.
The report uses one example link throughout:
https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/
Read it in parts. https:// is the protocol, the set of rules for fetching a web page securely. jub0bs.com is the host, the name of the server that holds the page. /posts/2021-01-29-great-samesite-confusion/ is the path, the location of the specific page on that server. A URL is like a postal address: the host is the building, the path is the flat number inside it.
The setup you need
Two things have to be true before the tricks below work:
- The workspace must actually have entries in its Blocked Previews list. Those entries can be a whole domain (every link to
jub0bs.com), one specific link, or every link under a subdirectory such asjub0bs.com/posts. - For the first trick, you cannot simply type the crafted URL into Slack's message box, because the Slack app will not let you post it that way. You need an intercepting proxy, a tool that sits between your browser and the internet, lets you see the request your browser is about to send, and lets you edit it before it goes out. The report names Burp as an example of such a tool. Think of it as a mail-sorting desk where you can open an envelope, change the address written on it, and seal it again before it is delivered.
Finding the weakness
The researcher noticed that when a URL is posted, the backend compares it against the blocked list without normalizing it first. Two consequences follow. First, a URL that means the same thing as a blocked one can look different as text. Second, a URL whose path is written in an unusual but still valid way can lead to a blocked page while not matching the blocked entry as a string.
To understand why this matters, you need to know what normalization is. Browsers and servers accept many spellings of the same address. A trailing dot in a host name is a legitimate way to write the same address. /a/../b and /b reach the same page, because .. means "go up one folder", just like in a file manager on your computer. Normalization is the process of rewriting all these spellings into one canonical form before comparing them. If a blocklist check skips that step, it is comparing spellings, not destinations.
Step 1: getting around a blocked domain with a trailing period
Suppose the workspace has blocked all previews from jub0bs.com. The researcher posted this URL instead:
https://jub0bs.com./posts/2021-01-29-great-samesite-confusion/
Line by line, in plain words:
https://is the same secure protocol as before.jub0bs.com.is the host, but with a period added at the very end. To a human this looks almost identical tojub0bs.com. To a computer doing a plain text comparison, it is a different string, because it has one extra character. Yet it still resolves to the same website, because a trailing dot in a host name is a legitimate way to write the same address./posts/2021-01-29-great-samesite-confusion/is the unchanged path to the page.
Posting the URL with the trailing period triggers a link preview despite the domain being blocked. The researcher had to send this request through an intercepting proxy such as Burp, because Slack's own message box would not let the URL through as typed.
Step 2: getting around a blocked link or subdirectory with a non-normalised path
Now suppose the workspace has blocked one specific link, https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/, or has blocked everything under the subdirectory jub0bs.com/posts. The researcher posted a URL of this shape:
https://jub0bs.com/ARBITRARY_PATH_SEGMENT/../posts/2021-01-29-great-samesite-confusion/
Line by line, in plain words:
https://jub0bs.comis the same protocol and host as before./ARBITRARY_PATH_SEGMENT/is a made-up folder name. It does not need to exist on the server. Its only job is to make the text of the URL different from the blocked entry./../means "go up one folder". In a file manager, if you are inside a folder and type.., you move to the parent folder. Here it cancels out the made-up segment that came just before it./posts/2021-01-29-great-samesite-confusion/is the real path to the page.
The URL has a non-normalised path, and posting it triggers a link preview despite the block. The raw text does not match the blocked specific link, and it does not start with the blocked subdirectory prefix either, so no block is applied and a preview appears.
Why it works
The root cause is that the backend does not normalise the posted URL before comparing it against the workspace's Blocked Previews list. Because no normalization is performed, a trailing period on the host or a .. segment in the path changes the string without changing the page. A trailing period on the host, or a .. segment in the path, changes the string without changing the page the URL leads to. Because the URL is not normalised, both the domain rule and the link or subdirectory rule can be bypassed.
A useful comparison: imagine a building with a doorman who has a list of banned visitors written by name. If the list says "John Smith" and someone arrives whose badge reads "John Smith." with a full stop, the doorman reads a different name and lets him in, even though it is the same person.
What this means for a workspace
Workspace Owners and Admins cannot easily block link previews in a reliable way. The trailing-period trick forces them to create an extra rule for every blocked domain, and the path trick completely defeats the blocking of a specific link or of everything under a subdirectory. As a result, malicious actors can get their links to preview in Slack regardless of the workspace's list of blocked previews.
The scenario is not limited to one team member attacking another. Links can also arrive through Slack integrations, for example the integration with Microsoft Outlook, so a link can enter the workspace without a person typing it.
Was it fixed?
The report does not describe any fix or remediation.
Other places to try the same idea
- A trailing period on the host of a blocked domain, as in
https://jub0bs.com./posts/2021-01-29-great-samesite-confusion/. A positive result is a preview appearing for a domain that is on the blocked list. - A made-up path segment followed by
..before the blocked path, as inhttps://jub0bs.com/ARBITRARY_PATH_SEGMENT/../posts/2021-01-29-great-samesite-confusion/. A positive result is a preview appearing for a blocked specific link or for a link under a blocked subdirectory.
Where to look for this kind of bug
This kind of bug hides in features that compare URLs supplied by users against a list. Examples are preview blocking, link allowlists and denylists, and redirect validation (checking where a link is allowed to send you). The signal is a blocklist check that appears to work on the raw string rather than on a normalised URL. To show impact, demonstrate that a URL which is textually different from a blocked entry but leads to the same page still produces the blocked behaviour, here a preview. Cover both the domain-level rule and the link or subdirectory-level rule, because the two bypasses are distinct.
Glossary
- Backend: the servers and software behind an app that do the real work, as opposed to the app you see on screen.
- Blocked Previews: a Slack feature that lets Workspace Owners and Admins list URLs for which no link preview should appear.
- Burp: an intercepting proxy tool used to view and edit web requests before they are sent.
- Domain: the name of a website, such as
jub0bs.com. - Host: the part of a URL that names the server holding the page, such as
jub0bs.com. - HTTPS: the secure version of the protocol browsers use to fetch web pages.
- Integration: a connection between Slack and another service, such as Microsoft Outlook, that can bring content into the workspace.
- Intercepting proxy: a tool that sits between your browser and the internet, letting you see and change requests before they go out.
- Link preview: the small card with a title, image or description that appears under a posted URL.
- Normalization: rewriting a URL into one standard form so that different spellings of the same address compare as equal.
- Path: the part of a URL that points to a specific page on a server, such as
/posts/2021-01-29-great-samesite-confusion/. - Protocol: the set of rules used to communicate, such as
https://. - Redirect validation: checking where a link is allowed to send a visitor before allowing the redirect.
- Root cause: the underlying reason a weakness exists.
- Subdirectory: a folder-like section of a website's path, such as
jub0bs.com/posts. - URL: a web address, such as
https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/. - Workspace: a team's Slack account, with its own members, settings and admins.
- Workspace Owners and Admins: the people who manage a Slack workspace and its settings.