Skip to content

Action does not validate that the SLACK_WEBHOOK_URL is a valid Slack webhook URL #621

@nikwen

Description

@nikwen

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:

config.inputs.webhook,

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,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions