Skip to content

Actions expression injection in `notify_team_new_comment.yml` (GHSL-2024-038)

Critical
rtibbles published GHSA-h5f9-gr6x-gr84 Mar 27, 2024

Package

No package listed

Affected versions

Before commit e4b7690182f7febd3388bcb0a4e832452a363932

Patched versions

After commit e4b7690182f7febd3388bcb0a4e832452a363932

Description

Summary

Kolibri is vulnerable to Actions expression injection allowing an attacker to alter the repository and steal secrets.

Details

The notify_team_new_comment.yml workflow is triggered on issue_comment (i.e., when a when a comment inside an Issue or Pull Request is created). The workflow starts with full write-permissions GitHub repository token since the default workflow permissions on Organization/Repository level are set to read-write.

Taking the above into account, this workflow injects data controlled by said Issue (${{ github.event.issue.title }} -- the title of the Issue) into a Run step's script, allowing an attacker to take over the GitHub Runner to run custom commands and alter the repository.

- name: Escape title double quotes
  id: escape_title
  run: |
    title='${{ github.event.issue.title }}'
    echo "ISSUE_TITLE=${title//\"/\\\"}" >> "$GITHUB_OUTPUT"

This issue was found using CodeQL for JavaScript's Expression injection in Actions query.

Impact

This issue may lead to stealing workflow secrets and modification of the repository.

Proof of Concept

  1. Open an Issue with the following title: '$(whoami)'
  2. Check the workflow runs for the new Actions run that will execute the command whoami.

Resources

Severity

Critical

CVE ID

No known CVE

Weaknesses

Credits