-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'oreenlivnicode-Add-Github-Actions-Attacks-Doc'
- Loading branch information
Showing
6 changed files
with
132 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...ing-ci-cd/github-security/abusing-github-actions/2-gh-actions-custom-actions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Gh Actions - Custom Actions | ||
|
||
{% hint style="success" %} | ||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1).png" alt="" data-size="line">\ | ||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte) | ||
|
||
<details> | ||
|
||
<summary>Support HackTricks</summary> | ||
|
||
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** | ||
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. | ||
|
||
</details> | ||
{% endhint %} | ||
|
||
## What are Custom Actions? | ||
|
||
Custom Actions in GitHub Actions are a popular option that allows users to encapsulate reusable tasks and streamline workflows, similar to dependencies in programming. The `uses` keyword is employed to import different actions, while the `with` keyword passes parameters to the custom action. | ||
|
||
```yaml | ||
- uses: actions/custom-action@4 | ||
with: | ||
token: ${{ github.token }} | ||
``` | ||
Workflows can pass information to custom actions, which may utilize user-controlled contexts (see [related resources](/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-context-script-injections.md)). If you identify a vulnerable usage of a user-controlled context within a custom action, investigate all the pipelines that include this action in their import chain for potential exploitation. This approach was highlighted in [this blog post](https://cycode.com/blog/cycode-discovers-a-supply-chain-vulnerability-in-bazel/) regarding a vulnerability found in Google's Bazel project. | ||
For more information about custom actions checkout [Github's documentation](https://docs.github.com/en/actions/sharing-automations/creating-actions/about-custom-actions#about-custom-actions) | ||
## Custom Action Types | ||
Each type of custom action can execute shell code using parameters passed from the workflow, which makes every dependency in a pipeline a potential exploitation point :) | ||
### Composite Actions | ||
Composite Actions combine multiple workflow steps into a single action. Each step can invoke shell commands or call other actions. | ||
```yaml | ||
name: example | ||
description: Example of a Composite Action | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: printenv | ||
shell: bash | ||
``` | ||
### Docker Actions | ||
Docker Actions run inside a Docker container and can be configured using a Dockerfile or an image. | ||
```yaml | ||
name: example | ||
description: Example of a Docker Action | ||
runs: | ||
using: docker | ||
image: Dockerfile | ||
env: | ||
INPUT_NAME: ${{ inputs.name }} | ||
INPUT_VERSION: ${{ inputs.version }} | ||
``` | ||
### JavaScript Actions | ||
JavaScript Actions are similar to Node.js programs that execute code and call different functions, utilizing the GitHub Actions Toolkit to interact with the workflow. | ||
```yaml | ||
name: example | ||
description: Example of a JavaScript Action | ||
runs: | ||
using: "node16" | ||
main: "dist/index.js" | ||
``` | ||
{% hint style="success" %} | ||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1).png" alt="" data-size="line">\ | ||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte) | ||
<details> | ||
<summary>Support HackTricks</summary> | ||
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** | ||
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. | ||
</details> | ||
{% endhint %} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters