🗝️ How Infostealers Harvest Credentials & Sessions for Underground Markets
Infostealer malware (such as commodity stealer families distributed via trojanized installers, malvertising, or phishing) targets saved browser passwords, session cookies/tokens, crypto wallet extensions, messaging sessions, and system host metadata—packaging them into structured victim logs sold or traded in underground markets. For defenders, identifying exposed corporate domains or session tokens early enables rapid password resets, session/token revocation, MFA hardening, and intrusion hunting before footholds escalate into full network compromise.
log_artifacts = [
("Passwords.txt", "Saved browser credentials", "HIGH: Enables password reuse / account access"),
("Cookies / Tokens", "Active browser/SSO sessions", "CRITICAL: Can bypass MFA if token/cookie valid"),
("Wallets/", "Browser/desktop wallet files", "HIGH: Financial exposure for affected users"),
("SystemInfo.txt", "OS, hostname, IP, AV, specs", "MEDIUM: Helps buyers gauge target value")
]
for artifact, scope, risk in log_artifacts:
print(f"{artifact:<20} | {scope:<30} | {risk}")
import json
exposure_summary = {
"incident_ref": "STL-2026-712",
"target_domain": "sso.example.com",
"artifacts_observed": ["session_token", "saved_credential"],
"observed_utc": "2026-11-28T01:20:00Z",
"raw_secrets_stored": False,
"remediation_state": "PENDING_TOKEN_REVOCATION"
}
print(json.dumps(exposure_summary, indent=2))
scenarios = [
("Stolen Password Only", "Password reset + MFA enforcement", "Blocks new logins using exposed password"),
("Stolen Session Cookie", "Revoke active sessions/refresh tokens + MFA","Invalidates live authenticated sessions")
]
for leak_type, primary_fix, why in scenarios:
print(f"{leak_type:<22} | Fix: {primary_fix:<41} | {why}")
protected_domains = {"corp.example.com", "vpn.example.com", "mail.example.com"}
observed_urls = [
"https://vpn.example.com/dana-na/auth/url_default/welcome.cgi",
"https://mail.example.com/owa/",
"https://external-vendor.example.net/login"
]
for url in observed_urls:
host = url.split("://", 1)[-1].split("/", 1)[0].lower()
matched = host in protected_domains
print(f"{host:<32} -> {'PROTECTED MATCH (Escalate)' if matched else 'External / Unlisted'}")
auth_events = [
{"user": "alice@example.com", "exposed_in_stealer": True, "asn_unusual": True, "success": True},
{"user": "bob@example.com", "exposed_in_stealer": False, "asn_unusual": False, "success": True},
]
for ev in auth_events:
high_risk = ev["exposed_in_stealer"] and ev["asn_unusual"] and ev["success"]
status = "CRITICAL ATO ALERT (Investigate & Revoke)" if high_risk else "Normal / Baseline"
print(f"{ev['user']:<22} | {status}")
stages = [
"Stage 1: Trojanized installer / lure delivers infostealer binary",
"Stage 2: Stealer extracts browser creds, cookies, & host metadata",
"Stage 3: Log or session access is used or sold to intrusion actors",
"Stage 4: Actor pivots into VPN/SSO/internal shares for extortion"
]
for s in stages:
print(s)
steps = [
"1. Revoke active sessions, OAuth/SSO tokens, and API keys for affected users",
"2. Force unique password resets and verify phishing-resistant MFA enrollment",
"3. Run endpoint EDR scan/isolation if host infection is suspected",
"4. Audit sign-in logs, inbox rules, and privilege changes for unauthorized activity"
]
for step in steps:
print(step)
hardening = {
"phishing_resistant_mfa_enforced": True,
"edr_active_and_updated": True,
"untrusted_downloads_restricted": True,
"token_binding_and_short_lifetimes": True
}
score = sum(1 for v in hardening.values() if v)
print(f"Endpoint & Identity Controls Active: {score}/{len(hardening)}")
print("Posture:", "STRONG" if score == len(hardening) else "IMPROVE CONTROLS")
import re
draft_note = "Affected domain: sso.example.com | Action: Revoked active tokens and reset password."
forbidden_patterns = [r"password\s*=\s*\S+", r"cookie\s*=\s*\S+", r"bearer\s+[A-Za-z0-9._-]+"]
leaks = [p for p in forbidden_patterns if re.search(p, draft_note, flags=re.IGNORECASE)]
print("Draft Note:", draft_note)
print("Secret Leak Check:", "CLEAN (No raw secrets detected)" if not leaks else f"BLOCKED ({leaks})")
compliance = {
"defensive_remediation_purpose_only": True,
"no_purchase_or_trafficking_of_stolen_data": True,
"minimal_metadata_and_redaction_enforced": True,
"approved_by_security_and_legal": True
}
approved = all(compliance.values())
print("Infostealer Intel Compliance Gate:", "APPROVED" if approved else "HOLD")