The GitHub action does not validate that the passed Slack webhook URL is a valid Slack webhook URL. Thus, an attacker can pass URLs that do not have the format https://hooks.slack.com/*.
If an attacker attacks a GitHub workflow which uses the Slack GitHub action and manages to set the SLACK_WEBHOOK_URL environment variable, they can make the Slack GitHub action send requests to any arbitrary URL (incl. servers on internal networks, or ports on the same machine). That's classic SSRF.
The Slack GitHub action should validate that the passed webhook URL is a valid webhook URL, i.e., has the format https://hooks.slack.com/*.
This is where the environment variable is being read:
|
core.getInput("webhook") || process.env.SLACK_WEBHOOK_URL || null, |
This is where the request is being sent, with no validation of the webhook URL:
I tried reporting this vulnerability responsibly through Slack's HackerOne program, but was told that this was not a security vulnerability. I still believe it should be fixed. Hence, this GitHub issue.
As an aside, similar attacks might (or might not) be possible for the API URL or the HTTPS proxy (I haven't had time to look into those):
|
api: core.getInput("api"), |
|
errors: core.getBooleanInput("errors"), |
|
method: core.getInput("method"), |
|
payload: core.getInput("payload"), |
|
payloadDelimiter: core.getInput("payload-delimiter"), |
|
payloadFilePath: core.getInput("payload-file-path"), |
|
payloadTemplated: core.getBooleanInput("payload-templated") || false, |
|
proxy: |
|
core.getInput("proxy") || |
|
process.env.HTTPS_PROXY || |
|
process.env.https_proxy || |
|
null, |
The GitHub action does not validate that the passed Slack webhook URL is a valid Slack webhook URL. Thus, an attacker can pass URLs that do not have the format
https://hooks.slack.com/*.If an attacker attacks a GitHub workflow which uses the Slack GitHub action and manages to set the
SLACK_WEBHOOK_URLenvironment variable, they can make the Slack GitHub action send requests to any arbitrary URL (incl. servers on internal networks, or ports on the same machine). That's classic SSRF.The Slack GitHub action should validate that the passed webhook URL is a valid webhook URL, i.e., has the format
https://hooks.slack.com/*.This is where the environment variable is being read:
slack-github-action/src/config.js
Line 121 in 9a2e0ee
This is where the request is being sent, with no validation of the webhook URL:
slack-github-action/src/webhook.js
Line 26 in 9a2e0ee
I tried reporting this vulnerability responsibly through Slack's HackerOne program, but was told that this was not a security vulnerability. I still believe it should be fixed. Hence, this GitHub issue.
As an aside, similar attacks might (or might not) be possible for the API URL or the HTTPS proxy (I haven't had time to look into those):
slack-github-action/src/config.js
Lines 106 to 117 in 9a2e0ee