forked from step-security/github-actions-goat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tutorials (step-security#161)
- Loading branch information
1 parent
e4e2fc2
commit 8a31825
Showing
11 changed files
with
48 additions
and
27 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
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 |
---|---|---|
@@ -1,15 +1,19 @@ | ||
# Audit and Rotate GitHub Actions Secrets | ||
|
||
> ["Minimize the use of long-term credentials" in CISA/NSA document](https://media.defense.gov/2023/Jun/28/2003249466/-1/-1/0/CSI_DEFENDING_CI_CD_ENVIRONMENTS.PDF): For software-to-software authentication, avoid using software-based long-term credentials as much as possible. | ||
[🔙 Go back to the list of tutorials](../../README.md#vulnerabilities-and-countermeasures) | ||
|
||
## Tutorial | ||
|
||
In this tutorial you will use the [StepSecurity Actions Security GitHub App](https://github.com/apps/stepsecurity-actions-security) to view the list of all your GitHub Actions Secret names and `Days Since Last Rotated`. This will help you understsand which secrets should be rotated. | ||
|
||
1. Add a GitHub Actions secret to your repository. Under your repository name, click Settings. In the "Security" section of the sidebar, select Secrets and variables, then click Actions. Click the Secrets tab. Click New repository secret and add a secret. You can add any name and value. | ||
1. Add a GitHub Actions secret to your repository. Under your repository name, click Settings. In the `Security` section of the sidebar, select ` Secrets and variables``, then click `Actions`` . Click the `Secrets `` tab. Click `New repository secret`` and add a secret. You can add any name and value. | ||
|
||
2. Install the [StepSecurity Actions Security GitHub App](https://github.com/apps/stepsecurity-actions-security) on your repository. You will get an email with a link to your dashboard. | ||
|
||
3. Then go to the `Actions Secrets` tab in the dashboard. Here you will be able to view the secret name along with `Days Since Last Rotated`. Since this is a new secret, that value will be 0. You can try on your own repository where you had created secrets on an earlier date. | ||
|
||
<img src="../../images/ActionsSecrets.png" alt="Link to security insights" width="800"> | ||
<img src="../../images/ActionsSecrets2.png" alt="Link to security insights" width="800"> | ||
|
||
> The App only needs `actions: read` and `secrets metadata: read` permissions on your repositories. `secrets metadata: read` permission only gives access to the list of GitHub Actions secret names (and not to the actual secret). |
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,23 @@ | ||
# Forensically Reconstruct An Incident Post-Compromise | ||
|
||
> **["Keep audit logs" section in CISA/NSA guide](https://media.defense.gov/2023/Jun/28/2003249466/-1/-1/0/CSI_DEFENDING_CI_CD_ENVIRONMENTS.PDF)**: An audit log should provide clear information on who committed, reviewed, and deployed what, when, and where. If all previous measures fail, an audit log will at least help **forensically reconstruct an incident post-compromise**, so it can be quickly addressed | ||
[🔙 Go back to the list of tutorials](../../README.md#vulnerabilities-and-countermeasures) | ||
|
||
## Tutorial | ||
|
||
In this tutorial, you will simulate an attack scenario, in which an attacker runs a workflow to exfiltrate CI/CD Secrets and then deletes the workflow run to remove evidence of the run. | ||
|
||
This can happen if a developer's credentials or a Personal Access Token (PAT) has been compromised, and then used to exfiltrate CI/CD Secrets. | ||
|
||
You will then locate the record for the worflow run in the StepSecurity dashboard and use it for forensic analysis. | ||
|
||
1. Go to the `Actions` tab and run the `Hosted: Network Monitoring with Harden-Runner` workflow. This is similar to an attacker with `write` access to the repository creating and running a workflow. | ||
|
||
2. Now do to the workflow run, click on the `...` next to it, and click on `Delete workflow run`. Now there is no evidence that this workflow ran. | ||
|
||
3. Now, to conduct forensic analysis, go to the `StepSecurity Dashboard` and click on the `Runtime Security` tab. | ||
|
||
4. You should see a record for the workflow run and can click on it to view the outbound calls made during the run, and what process made the call. | ||
|
||
5. This is important forensic information that can help confirm the incident, and identify the step and the process that exfiltrated secrets. It can also be used to understand who ran the workflow to identify whose credentials have been compromised. |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.