System Hacking: Access and Privilege Escalation
Examine access vectors, privilege escalation paths, persistence, and EDR-aware tradecraft.
Content
Credential Harvesting and Reuse Risks
Versions:
Watch & Learn
AI-discovered learning video
Sign in to watch the learning video for this topic.
Credential Harvesting and Reuse Risks — The Chaotic Clinic for Stolen Keys
Imagine finding a janitor's keyring in the server room. Now imagine every key on it opens something important.
We’ve already mapped the attack surface and practiced initial access in the last unit (you remember: reconnaissance, footholds, and that uncomfortable feeling when you realize a service account has a password like "P@ssword1"). Now we’re zooming in on what attackers do next: collect credentials, reuse them, and climb from a single compromised user to full-blown domain admin chaos.
Why this matters: credential theft is the highway from limited compromise to full system takeover. And — spoiler — fixing software bugs only gets you halfway. Credentials and secrets are people's bad habits baked into code and ops.
What is Credential Harvesting? (And why it's like dumpster-diving)
Credential harvesting is the collection of authentication material (passwords, tokens, keys, certificates, session cookies) from systems, users, or code. Attackers harvest credentials to impersonate users, escalate privileges, and move laterally.
Common harvesting vectors — each a little horror story of human or system error:
- Phishing & Social Engineering — trick the human to give credentials. Classic. Still effective. Still enraging.
- Credential Stuffing & Password Reuse — people reuse passwords; attackers try leaked combos across sites and services.
- Memory / LSASS Scraping & Token Theft — ephemeral tokens and in-memory secrets can be plucked from running systems.
- Repository / CI/CD Leaks — secrets accidentally checked into Git, or embedded in pipeline configs.
- Cloud Metadata & IAM Misconfigurations — instance metadata endpoints or over-privileged roles leaking cloud keys.
- Keylogging / Malware / Endpoint Agents — captures typed credentials or saved session cookies.
Ask yourself: where are the keys in your environment? In human heads, in code, in config, in logs, in third-party SaaS? Each location is a target.
Attack Patterns (Short, Memeworthy Analogies)
- Phishing: "You just handed me the keys because my email looked like HR." — attacker = social locksmith.
- Pass-the-Hash/Pass-the-Ticket: "I don't need the password if I can hand someone your ticket." — attacker uses authentication artifacts, not plaintext.
- Credential Stuffing: "Doorbells everywhere. If one matches, I walk in." — reuse enables mass automation.
- Repo Secrets: "Developer copy-pastes the secrets into Git like they’re sticky notes." — immediate invite for scanners.
Build on DevSecOps: Where CI/CD Meets Credential Risk
You learned to integrate vulnerability scanning into pipelines. Now extend that to secret and credential scanning and secrets management.
Add secret scanning to CI (detect credentials in commits and pull requests). Tools: detect-secrets (Yelp), git-secrets, truffleHog. Use pre-commit hooks and pipeline jobs to block secrets from landing in main branches.
Shift secret provisioning out of code into a secrets manager (HashiCorp Vault, AWS Secrets Manager, Azure Key Vault). CI jobs should fetch ephemeral creds via short-lived tokens, not bake long-lived keys into YAML.
Automate rotation and verification: tie credential rotation checks into your remediation/verification workflows from the previous unit. If a secret is rotated or revoked, the pipeline must validate the new secret works before promoting.
Sample (safe) GitHub Actions job snippet to scan commits (conceptual):
# CI job outline — run a secrets scanner, fail on matches
jobs:
secret_scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run secret scanner
run: detect-secrets scan --baseline .secrets.baseline
(This shows integration intent; pick the scanner that fits your org and harden with proper rules.)
Detection and Response: Spotting Credential Theft in the Wild
Good defenders combine telemetry and deception:
- Log sources: AD logs (auth failures, ticket anomalies), cloud IAM logs, EDR alerts, suspicious process behavior, unusual token usage.
- Anomaly detection: multiple failed logins followed by a success from new IP; reuse of administrative sessions; sudden service account use at odd hours.
- Honeytokens / Canary Tokens: plant fake AWS keys, fake credentials, or webhooks. If they’re used, you get an alert — immediate signal of credential theft.
- Just-in-time monitoring: alert when service accounts are used from non-standard hosts or regions.
Remember: harvesting often precedes privilege escalation and lateral movement. Catch the credential theft early and you cut off the attacker’s climb.
Risk Table: Attack Types vs Mitigations
| Attack Vector | Core Risk | Defensive Controls |
|---|---|---|
| Phishing / Social | User credentials stolen | MFA, phishing-resistant auth (FIDO2), user training, simulated phishing |
| Credential Reuse | Compromise across services | Password managers, unique passwords, breach monitoring |
| Repo Secrets | Leaked API keys/keys-in-Git | Secret scanning in CI, pre-commit hooks, remove secrets from history, secret vaults |
| Memory / Token Theft | Session tokens / tickets stolen | EDR protections, limit token lifetimes, Kerberos hardening |
| Cloud Metadata / IAM | Excessive cloud privileges | Least privilege, IMDS v2, role separation, rotate keys, use instance roles |
Practical Hardening Checklist (Prioritize these)
- Enforce MFA or phishing-resistant MFA for all sensitive accounts.
- Integrate secret scanning into CI/CD — block PRs with detected secrets and automate rotation.
- Use a centralized secrets manager and short-lived ephemeral credentials for services and pipelines.
- Apply least privilege to service accounts; prefer just-in-time privilege elevation.
- Rotate credentials automatically and audit their usage — tie to remediation workflows.
- Deploy honeytokens to detect misuse early.
- Monitor authentication telemetry and set anomaly alerts.
- Educate devs and ops about not committing secrets and how to use vaults.
Closing — The Takeaway You’ll Actually Remember
Credentials are the most abused resources in modern environments because they’re easy to harvest and extremely powerful when reused. Your pipeline scans and vulnerability remediation practices are great — now extend that discipline to secrets and credential hygiene. Treat secrets like radioactive material: don’t leave them lying around, store them in a vault, have a rotation plan, and monitor for unexpected use.
Final challenge: in your next sprint, add a secret-scan job to your CI, rotate one set of long-lived keys, and deploy a canary token for a non-critical service. If you do those three things, you’ll have drastically reduced an attacker's ability to go from initial access to full takeover.
Security is 10% tools and 90% stopping people from making catastrophic Typos With Keys. Be the reason your org doesn’t hand out the janitor’s keyring to strangers.
Comments (0)
Please sign in to leave a comment.
No comments yet. Be the first to comment!