Skip to content
CSRF Disclosed report Beginner

CSRF in github integration

A CSRF in Slack's GitHub integration let an attacker force a channel admin to switch the integration to unauthenticated mode by visiting a malicious page, causing the admin to lose the GitHub integration.

Antonio Sanso Follow

Originally disclosed on HackerOne

Bounty$500 Medium View original
  • Triaged in 31 hours
  • Fixed in 12 days
  • Paid in 8 days
  • Disclosed after 43 days

Summary by the researcher

CSRF in Github integration

The report

There is a CSRF in the github integration in the case of "Only pre-approved apps can be installed by team members: (slack1.png) Github is not one of those pre approved application. So a normal user cannot install it (slack2) Now lets assume the channel administrator is adding this integration to one common channel e.g. #random (slack3.png). Now the other non admin users receive a notification "added an integration to this channel: github" (slack4.png) but if they try to click the link they will have a page saying "added an integration to this channel: github" (slack5.png). The problem is that they still have the uri of the integration, that is something like https://vecchiowerther.slack.com/services/CODE E.g. https://vecchiowerther.slack.com/services/B2L476P3P

This can be used to make the admin of the channel to "switch to unauthed mode". For the attacker is enough to forge a an html page as

<html> </html>

e.g. in http://asanso.github.io/csrf.html (or in any website). If the admin will visit this website he will loose the github integration and switch to the unauthed mode (slack6.png)

Attachments

slack2.png
slack2.png From the original on HackerOne
slack1.png
slack1.png
slack4.png
slack4.png
slack3.png
slack3.png
slack5.png
slack5.png
slack6.png
slack6.png

The original report as published on HackerOne, by asanso. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Slack's GitHub integration lets a workspace connect a GitHub repository to a Slack channel so that commits, pull requests and other repository events are posted into that channel. Installing an integration is an administrative action: it binds an external service to a channel and, in the case of GitHub, involves an authorisation step between Slack and GitHub.

The report describes a cross-site request forgery (CSRF) in that installation flow. The relevant workspace setting is the one that restricts which apps team members may install: "Only pre-approved apps can be installed by team members". GitHub is not on that pre-approved list, so a normal (non-admin) user cannot install the integration. A channel administrator can, however, add it to a channel, and the researcher found that the state of that integration can later be changed by a forged request from any website the administrator visits.

Setup

The scenario needs three things:

  1. A workspace where "Only pre-approved apps can be installed by team members" is enabled and GitHub is not pre-approved.
  2. A channel administrator who installs the GitHub integration into a channel, for example #random.
  3. Other, non-admin members of that channel, who receive a notification about the new integration.

The researcher's proof of concept is a static HTML page hosted on a personal GitHub Pages site, http://asanso.github.io/csrf.html, though the report notes it would work from any website.

Finding it

With the pre-approval restriction in place, a normal user who tries to install GitHub is blocked. The researcher's screenshots show the setting and the blocked installation.

slack2.png
slack2.png From the original on HackerOne
slack1.png
slack1.png

When the channel administrator adds the integration to a common channel such as #random, the other, non-admin users in that channel get a notification: "added an integration to this channel: github".

slack4.png
slack4.png From the original on HackerOne
slack3.png
slack3.png

Clicking the link in that notification does not give them access to the integration configuration; they land on a page that merely repeats "added an integration to this channel: github".

slack5.png
slack5.png From the original on HackerOne

What the researcher noticed is that the non-admin users still learn the URI of the integration, of the form:

Text
https://vecchiowerther.slack.com/services/CODE

with the example:

Text
https://vecchiowerther.slack.com/services/B2L476P3P

That identifier is the interesting part. The page is not usable by a non-admin, but the URL identifies the integration, and the researcher reasoned that a request to it could be used to make the channel administrator "switch to unauthed mode", that is, drop the GitHub authorisation for the integration.

Exploitation

Step 1: obtain the integration URI

The attacker needs the integration identifier. In the scenario described, this comes from the notification that every member of the channel receives when the administrator adds the integration, and from the page those members reach when they click it. The URL has the shape https://<workspace>.slack.com/services/<CODE>, for example https://vecchiowerther.slack.com/services/B2L476P3P.

Step 2: build a forged page

The attacker forges an HTML page that issues the request to that URI. The report gives the page as:

HTML
<html>
{{media:0}}
</html>

The report shows the forged page as an image between the <html> tags, and the researcher hosted it at http://asanso.github.io/csrf.html, noting any website would do.

Step 3: get the administrator to visit it

When the channel administrator visits the page, the browser sends the request to the integration URI with the administrator's session. The result, according to the report, is that the administrator loses the GitHub integration and the integration switches to unauthed mode.

slack6.png
slack6.png From the original on HackerOne

No interaction beyond loading the page is described, and no token or confirmation step is mentioned.

Root cause

The report does not describe any anti-CSRF token, origin check or confirmation step on the request to the integration URI. The report does not describe any anti-CSRF token, origin check or confirmation step on that request, and the fact that a plain HTML page hosted on an unrelated domain is enough to trigger the change implies there is none that the attacker has to satisfy.

The pre-approval setting does not help here. It controls who may install an app, not who may change the state of an already installed integration, and the non-admin users' inability to open the integration page does not prevent them from learning its URI.

Impact

The attack targets a channel administrator, and only succeeds if that administrator visits the attacker's page while logged in. When it succeeds, the GitHub integration is disconnected from its authorisation and switches to unauthed mode: the administrator loses the integration.

Fix

The measure that addresses the described behaviour is to require a CSRF token, or an equivalent same-origin check, on the request that changes the integration's authorisation state, so that a request forged from another site cannot perform it.

Variants to test

  • Other integration state changes. Try the same forged-page approach against disconnect, reconnect, reauthorise and configuration-update actions for other integrations. A positive result is the integration changing state after the administrator merely loads an attacker page.
  • Integration URIs leaked to non-privileged members. Check whether channel notifications or error pages expose /services/<CODE> identifiers to users who cannot use them. A positive result is a member without rights obtaining a working identifier.
  • Pre-approval bypasses. Where an app is not pre-approved, test whether an administrator's installation can be manipulated by a non-admin through a cross-site request. A positive result is a non-admin causing an installation or state change that the policy should prevent.
  • GET-based state changes. Look for state-changing actions reachable by a simple navigation, since those can be triggered by an image tag or link as well as a form. A positive result is a state change from a plain GET to the endpoint.

Hunting notes

This kind of bug tends to sit in the administrative edges of integrations: the endpoints that connect, disconnect and reconfigure third-party services, which are often built separately from the main application and may not share its CSRF protections. During recon, look for identifiers of the form /services/<CODE> appearing in notifications, emails or pages shown to users who lack the rights to act on them; that leak is what makes the forged request possible. The researcher showed impact by demonstrating a concrete, observable state change on the administrator's integration.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

Slack is a chat application where teams work in shared rooms called channels. It can be connected to other services so that events from those services appear as messages in a channel. One of those services is GitHub, a website where programmers keep and share code. When you connect GitHub to a Slack channel, new commits and pull requests in a code repository get posted into that channel. Connecting an outside service like this is called installing an integration.

Installing an integration is an administrative action. It ties an outside service to a channel, and with GitHub it also involves an authorisation step between Slack and GitHub, meaning the two services agree to talk to each other on your behalf.

A workspace can be configured so that only certain apps are allowed. The setting in question is called "Only pre-approved apps can be installed by team members". GitHub is not on that pre-approved list, so an ordinary team member, someone who is not an administrator, cannot install it.

A channel administrator can still add the integration to a channel. The researcher found that the state of that integration can later be changed by a forged request sent from any website the administrator happens to visit. A forged request is one the administrator never intended to make: their browser sends it because a page told it to, not because the person clicked something meaningful.

This class of bug is called cross-site request forgery, or CSRF. The everyday comparison: imagine you have a signed note from your bank authorising a transfer, and you keep it in your pocket. If a stranger can trick you into walking into the bank with that note in your pocket, the clerk will accept it, because the clerk only checks the note, not whether you meant to use it. In a browser, your login session is that note, and it travels with every request your browser makes to the site, even requests triggered by a completely different website.

Setup

The scenario needs three things:

  1. A workspace where "Only pre-approved apps can be installed by team members" is enabled and GitHub is not pre-approved.
  2. A channel administrator who installs the GitHub integration into a channel, for example #random.
  3. Other, non-admin members of that channel, who receive a notification about the new integration.

The researcher's proof of concept is a static HTML page hosted on a personal GitHub Pages site, http://asanso.github.io/csrf.html. GitHub Pages is a free service that publishes plain web pages from a code repository. The report notes the page would work from any website.

Finding it

With the pre-approval restriction in place, a normal user who tries to install GitHub is blocked. The researcher's screenshots show the setting and the blocked installation.

slack2.png
slack2.png From the original on HackerOne
slack1.png
slack1.png

When the channel administrator adds the integration to a common channel such as #random, the other, non-admin users in that channel get a notification: "added an integration to this channel: github".

slack4.png
slack4.png From the original on HackerOne
slack3.png
slack3.png

Clicking the link in that notification does not give them access to the integration configuration. They land on a page that merely repeats "added an integration to this channel: github".

slack5.png
slack5.png From the original on HackerOne

What the researcher noticed is that the non-admin users still learn the address of the integration, of the form:

Text
https://vecchiowerther.slack.com/services/CODE

with the example:

Text
https://vecchiowerther.slack.com/services/B2L476P3P

That identifier is the interesting part. The page is not usable by a non-admin, but the URL identifies the integration. The researcher reasoned that a request to it could be used to make the channel administrator "switch to unauthed mode", that is, drop the GitHub authorisation for the integration.

Exploitation

Step 1: obtain the integration URI

The attacker needs the integration identifier. In the scenario described, this comes from the notification that every member of the channel receives when the administrator adds the integration, and from the page those members reach when they click it. The URL has the shape https://<workspace>.slack.com/services/<CODE>, for example https://vecchiowerther.slack.com/services/B2L476P3P.

A URI, or URL, is simply a web address. The <CODE> part is a short identifier that points at one particular integration, the way a house number points at one particular house on a street. The attacker does not need to guess it, because Slack hands it out to every member of the channel in the notification.

Step 2: build a forged page

The attacker forges an HTML page that issues the request to that URI. HTML is the language web pages are written in. The report gives the page as:

HTML
<html>
{{media:0}}
</html>

The report shows the forged page as an image between the <html> tags. The researcher hosted the result at http://asanso.github.io/csrf.html, and notes that any website would do.

Line by line: <html> opens the page, and </html> closes it. Everything that actually triggers the request sits between them, shown in the report as an image. The idea is that simply loading the page causes the browser to send a request to the integration address, without the visitor doing anything else.

Step 3: get the administrator to visit it

When the channel administrator visits the page, the browser sends the request to the integration URI with the administrator's session. The result, according to the report, is that the administrator loses the GitHub integration and the integration switches to unauthed mode.

slack6.png
slack6.png From the original on HackerOne

A session is how a website remembers who you are between page loads. When you log in, the site gives your browser a small piece of data, often called a cookie, and the browser sends it back with every request to that site. That is why the forged request works: the browser attaches the administrator's session automatically, so Slack sees a request that looks like it came from the administrator.

No interaction beyond loading the page is described, and no token or confirmation step is mentioned. A confirmation step would be something like a pop-up asking "are you sure?", and an anti-CSRF token would be a secret value the page must include, which a page on another site cannot know.

Root cause

The report does not describe any anti-CSRF token, origin check or confirmation step on the request to the integration URI. The report does not describe any anti-CSRF token, origin check or confirmation step on that request. The fact that a plain HTML page hosted on an unrelated domain is enough to trigger the change implies there is none that the attacker has to satisfy.

An endpoint is a specific address on a server that performs a specific action, like a particular counter at a service desk. An origin check is a server-side test of which website a request came from. The pre-approval setting does not help here: it controls who may install an app, not who may change the state of an already installed integration. The non-admin users' inability to open the integration page does not prevent them from learning its URI.

Impact

The attack targets a channel administrator, and only succeeds if that administrator visits the attacker's page while logged in. When it succeeds, the GitHub integration is disconnected from its authorisation and switches to unauthed mode: the administrator loses the integration.

Fix

The measure that addresses the described behaviour is to require a CSRF token, or an equivalent same-origin check, on the request that changes the integration's authorisation state, so that a request forged from another site cannot perform it. A CSRF token is a random value that the real Slack page includes in its requests; a page on another site cannot read it, so its forged request is rejected.

Variants to test

  • Other integration state changes. Try the same forged-page approach against disconnect, reconnect, reauthorise and configuration-update actions for other integrations. A positive result is the integration changing state after the administrator merely loads an attacker page.
  • Integration URIs leaked to non-privileged members. Check whether channel notifications or error pages expose /services/<CODE> identifiers to users who cannot use them. A positive result is a member without rights obtaining a working identifier.
  • Pre-approval bypasses. Where an app is not pre-approved, test whether an administrator's installation can be manipulated by a non-admin through a cross-site request. A positive result is a non-admin causing an installation or state change that the policy should prevent.
  • GET-based state changes. Look for state-changing actions reachable by a simple navigation, since those can be triggered by an image tag or link as well as a form. A positive result is a state change from a plain GET to the endpoint. GET is the ordinary kind of request a browser makes when you click a link or load an image.

Hunting notes

This kind of bug tends to sit in the administrative edges of integrations: the endpoints that connect, disconnect and reconfigure third-party services, which are often built separately from the main application and may not share its CSRF protections. During recon, look for identifiers of the form /services/<CODE> appearing in notifications, emails or pages shown to users who lack the rights to act on them; that leak is what makes the forged request possible. The researcher showed impact by demonstrating a concrete, observable state change on the administrator's integration.

Glossary

  • API: a defined set of addresses and rules one program uses to talk to another, like a service counter with specific forms to fill in.
  • Channel: a shared room in Slack where a team's messages appear.
  • Cookie: a small piece of data a website stores in your browser and gets back on later requests, often used to remember that you are logged in.
  • Cross-site request forgery (CSRF): tricking a logged-in user's browser into sending a request the user did not intend, because the browser attaches their session automatically.
  • CSRF token: a random secret value a real page must include in a request so the server can tell it apart from a forged one.
  • Endpoint: a specific address on a server that performs a specific action.
  • GET: the ordinary request a browser makes when loading a page, clicking a link or loading an image.
  • GitHub: a website for storing and sharing code, with features for tracking changes and collaboration.
  • GitHub Pages: a free service that publishes plain web pages from a GitHub repository.
  • HTML: the language web pages are written in.
  • Integration: a connection between Slack and an outside service so that events from that service appear in a channel.
  • Origin check: a server-side test of which website a request came from.
  • Pre-approved app: an app an administrator has allowed team members to install without further approval.
  • Session: the state that lets a website remember who you are across page loads, usually carried by a cookie.
  • Severity: a rating of how serious a security issue is.
  • URI / URL: a web address pointing at a particular resource.
  • Workspace: a single organisation's Slack setup, with its own channels, members and settings.

More by Antonio Sanso

View all

3 more disclosed reports, best first.

More from Slack

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.