[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71AFVJ2B2S5DWXVJ0HC2460":3,"skill-same:01M71AFVJ2B2S5DWXVJ0HC2460":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":6,"ownerDescription":58,"updatedAt":59,"install":60,"resources":72},"01M71AFVJ2B2S5DWXVJ0HC2460","cyber-analyzing-email-headers-for-phishing-investigation",null,"Parse and analyze email headers to trace the origin of phishing emails, verify sender authenticity, and identify spoofing through SPF, DKIM, and DMARC validation.","nexuslinkproductions\u002Fyuri-os","nexuslinkproductions","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F273246263?v=4","01M718YX9NZRCW50B59B8ZVDKN","Marcel Spatz","01M718YXAQ7530F4B1VKN6SFQV",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-analyzing-email-headers-for-phishing-investigation\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000005","邮件与沟通","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"headers","analyzing","analyzing email headers for phishing investigation","email","for","phishing","investigation","cyber analyzing email headers for phishing investigation","spf","email-analysis","NIST","authenticity","apache","subdomain","analyze","analysis","aml","false","cybersecurity","parse","2026-11-10 10:12:30",false,"---\nname: cyber-analyzing-email-headers-for-phishing-investigation\ndescription: \"Parse and analyze email headers to trace the origin of phishing emails, verify sender authenticity, and identify spoofing through SPF, DKIM, and DMARC validation.\"\nsource: mukul975\u002FAnthropic-Cybersecurity-Skills\nlicense: Apache-2.0\nauthorized_lab: false\norigin_frontmatter: \"name: analyzing-email-headers-for-phishing-investigation | description: Parse and analyze email headers to trace the origin of phishing emails, |   verify sender authenticity, and identify spoofing through SPF, DKIM, and DMARC validation. | domain: cybersecurity | subdomain: digital-forensics | tags: | - forensics | - email-analysis | - phishing | - spf | - dkim | - dmarc | - header-analysis | version: '1.0' | author: mahipal | license: Apache-2.0 | atlas_techniques: | - AML.T0052 | nist_csf: | \"\nhide: true\n---\n\n> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Analyzing Email Headers for Phishing Investigation\n\n## When to Use\n- When investigating a suspected phishing email to determine its true origin\n- For verifying sender authenticity and detecting email spoofing\n- During incident response when a user has clicked a phishing link\n- When tracing the delivery path and relay servers of a suspicious email\n- For validating SPF, DKIM, and DMARC alignment to identify forgery\n\n## Prerequisites\n- Raw email headers from the suspicious message (EML or MSG format)\n- Understanding of SMTP protocol and email header fields\n- Access to DNS lookup tools (dig, nslookup) for SPF\u002FDKIM\u002FDMARC verification\n- Email header analysis tools (MHA, emailheaders.net concepts)\n- Python with email parsing libraries for automated analysis\n- Access to threat intelligence platforms for IP\u002Fdomain reputation\n\n## Workflow\n\n### Step 1: Extract Raw Email Headers\n\n```bash\n# Export from Outlook: Open email > File > Properties > Internet Headers\n# Export from Gmail: Open email > Three dots > Show original\n# Export from Thunderbird: View > Message Source\n\n# If working with EML file from forensic image\ncp \u002Fmnt\u002Fevidence\u002FUsers\u002Fsuspect\u002FAppData\u002FLocal\u002FMicrosoft\u002FOutlook\u002Fphishing_email.eml \\\n   \u002Fcases\u002Fcase-2024-001\u002Femail\u002F\n\n# If working with PST file, extract individual messages\npip install pypff\npython3 \u003C\u003C 'PYEOF'\nimport pypff\n\npst = pypff.file()\npst.open(\"\u002Fcases\u002Fcase-2024-001\u002Femail\u002Foutlook.pst\")\nroot = pst.get_root_folder()\n\ndef extract_messages(folder, path=\"\"):\n    for i in range(folder.get_number_of_sub_messages()):\n        msg = folder.get_sub_message(i)\n        headers = msg.get_transport_headers()\n        subject = msg.get_subject()\n        if headers:\n            filename = f\"\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fmsg_{i}_{subject[:30]}.txt\"\n            with open(filename, 'w') as f:\n                f.write(headers)\n    for i in range(folder.get_number_of_sub_folders()):\n        extract_messages(folder.get_sub_folder(i))\n\nextract_messages(root)\nPYEOF\n```\n\n### Step 2: Parse the Email Header Chain\n\n```bash\n# Parse headers using Python email library\npython3 \u003C\u003C 'PYEOF'\nimport email\nfrom email import policy\n\nwith open('\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fphishing_email.eml', 'r') as f:\n    msg = email.message_from_file(f, policy=policy.default)\n\nprint(\"=== KEY HEADER FIELDS ===\")\nprint(f\"From:          {msg['From']}\")\nprint(f\"To:            {msg['To']}\")\nprint(f\"Subject:       {msg['Subject']}\")\nprint(f\"Date:          {msg['Date']}\")\nprint(f\"Message-ID:    {msg['Message-ID']}\")\nprint(f\"Reply-To:      {msg['Reply-To']}\")\nprint(f\"Return-Path:   {msg['Return-Path']}\")\nprint(f\"X-Mailer:      {msg['X-Mailer']}\")\nprint(f\"X-Originating-IP: {msg['X-Originating-IP']}\")\n\nprint(\"\\n=== RECEIVED HEADERS (bottom-up = chronological) ===\")\nreceived_headers = msg.get_all('Received')\nif received_headers:\n    for i, header in enumerate(reversed(received_headers)):\n        print(f\"\\nHop {i+1}: {header.strip()}\")\n\nprint(\"\\n=== AUTHENTICATION RESULTS ===\")\nauth_results = msg.get_all('Authentication-Results')\nif auth_results:\n    for result in auth_results:\n        print(result)\n\nprint(f\"\\nARC-Authentication-Results: {msg.get('ARC-Authentication-Results', 'Not present')}\")\nprint(f\"Received-SPF: {msg.get('Received-SPF', 'Not present')}\")\nprint(f\"DKIM-Signature: {msg.get('DKIM-Signature', 'Not present')}\")\nPYEOF\n```\n\n### Step 3: Validate SPF, DKIM, and DMARC Records\n\n```bash\n# Extract the envelope sender domain\nSENDER_DOMAIN=\"example-corp.com\"\n\n# Check SPF record\ndig TXT $SENDER_DOMAIN +short | grep \"v=spf1\"\n# Example: \"v=spf1 include:_spf.google.com include:sendgrid.net ~all\"\n\n# Check DKIM record (selector from DKIM-Signature header, e.g., \"s=selector1\")\nDKIM_SELECTOR=\"selector1\"\ndig TXT ${DKIM_SELECTOR}._domainkey.${SENDER_DOMAIN} +short\n\n# Check DMARC record\ndig TXT _dmarc.${SENDER_DOMAIN} +short\n# Example: \"v=DMARC1; p=reject; rua=mailto:dmarc@example-corp.com; pct=100\"\n\n# Verify the sending IP against SPF\n# Extract IP from first Received header\nSENDING_IP=\"203.0.113.45\"\n\n# Manual SPF check using python\npython3 \u003C\u003C 'PYEOF'\nimport spf  # pip install pyspf\n\nresult, explanation = spf.check2(\n    i='203.0.113.45',\n    s='sender@example-corp.com',\n    h='mail.example-corp.com'\n)\nprint(f\"SPF Result: {result}\")\nprint(f\"Explanation: {explanation}\")\n# Results: pass, fail, softfail, neutral, none, temperror, permerror\nPYEOF\n\n# Check if sending IP is in known malicious IP lists\n# Query AbuseIPDB or VirusTotal\ncurl -s \"https:\u002F\u002Fapi.abuseipdb.com\u002Fapi\u002Fv2\u002Fcheck?ipAddress=${SENDING_IP}\" \\\n   -H \"Key: YOUR_API_KEY\" -H \"Accept: application\u002Fjson\" | python3 -m json.tool\n```\n\n### Step 4: Analyze Sender Domain and Infrastructure\n\n```bash\n# WHOIS lookup on sender domain\nwhois $SENDER_DOMAIN | grep -iE '(registrar|creation|expiration|registrant|nameserver)'\n\n# Check domain age (recently registered domains are suspicious)\n# DNS record investigation\ndig A $SENDER_DOMAIN +short\ndig MX $SENDER_DOMAIN +short\ndig NS $SENDER_DOMAIN +short\n\n# Reverse DNS on sending IP\ndig -x $SENDING_IP +short\n\n# Check for lookalike\u002Ftyposquatting domains\n# Compare with legitimate domain using visual similarity\npython3 \u003C\u003C 'PYEOF'\nimport Levenshtein  # pip install python-Levenshtein\n\nlegitimate = \"microsoft.com\"\nsuspicious = \"micr0soft.com\"\n\ndistance = Levenshtein.distance(legitimate, suspicious)\nratio = Levenshtein.ratio(legitimate, suspicious)\nprint(f\"Edit distance: {distance}\")\nprint(f\"Similarity ratio: {ratio:.2%}\")\nif ratio > 0.8:\n    print(\"WARNING: Likely typosquatting\u002Flookalike domain!\")\nPYEOF\n\n# Check domain reputation on VirusTotal\ncurl -s \"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fdomains\u002F${SENDER_DOMAIN}\" \\\n   -H \"x-apikey: YOUR_VT_API_KEY\" | python3 -m json.tool\n\n# Check if the Reply-To differs from From (common phishing indicator)\npython3 -c \"\nimport email\nwith open('\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fphishing_email.eml') as f:\n    msg = email.message_from_file(f)\nfrom_addr = email.utils.parseaddr(msg['From'])[1]\nreply_to = email.utils.parseaddr(msg.get('Reply-To', msg['From']))[1]\nif from_addr != reply_to:\n    print(f'WARNING: From ({from_addr}) != Reply-To ({reply_to})')\nelse:\n    print('From and Reply-To match')\n\"\n```\n\n### Step 5: Examine Email Body and Attachments\n\n```bash\n# Extract URLs from email body\npython3 \u003C\u003C 'PYEOF'\nimport email\nimport re\nfrom email import policy\n\nwith open('\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fphishing_email.eml', 'r') as f:\n    msg = email.message_from_file(f, policy=policy.default)\n\nbody = msg.get_body(preferencelist=('html', 'plain'))\nif body:\n    content = body.get_content()\n    urls = re.findall(r'https?:\u002F\u002F[^\\s\u003C>\"\\']+', content)\n    print(\"=== URLs FOUND IN EMAIL BODY ===\")\n    for url in set(urls):\n        print(f\"  {url}\")\n\n    # Check for URL obfuscation (display text != href)\n    href_pattern = re.findall(r'\u003Ca[^>]*href=[\"\\']([^\"\\']+)[\"\\'][^>]*>(.*?)\u003C\u002Fa>', content, re.DOTALL)\n    print(\"\\n=== HYPERLINK ANALYSIS ===\")\n    for href, text in href_pattern:\n        display_url = re.findall(r'https?:\u002F\u002F[^\\s\u003C]+', text)\n        if display_url and display_url[0] != href:\n            print(f\"  MISMATCH: Display='{display_url[0]}' -> Actual='{href}'\")\n\n# Extract and hash attachments\nprint(\"\\n=== ATTACHMENTS ===\")\nfor part in msg.walk():\n    if part.get_content_disposition() == 'attachment':\n        filename = part.get_filename()\n        content = part.get_payload(decode=True)\n        import hashlib\n        sha256 = hashlib.sha256(content).hexdigest()\n        print(f\"  File: {filename}, Size: {len(content)}, SHA-256: {sha256}\")\n        with open(f'\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fattachments\u002F{filename}', 'wb') as af:\n            af.write(content)\nPYEOF\n\n# Submit attachment hashes to VirusTotal\n# Submit URLs to URLhaus or PhishTank for reputation check\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| SPF (Sender Policy Framework) | DNS record specifying authorized mail servers for a domain |\n| DKIM (DomainKeys Identified Mail) | Cryptographic signature verifying email content integrity |\n| DMARC | Policy framework combining SPF and DKIM for sender authentication |\n| Received headers | Server-added headers showing each hop in the delivery chain (read bottom to top) |\n| Return-Path | Envelope sender address used for bounce messages; may differ from From |\n| Message-ID | Unique identifier assigned by the originating mail server |\n| X-Originating-IP | Original sender IP address (added by some mail services) |\n| Header forgery | Attackers can forge From, Reply-To, and other headers but not Received chains |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| MXToolbox | Online email header analyzer and DNS lookup |\n| dig\u002Fnslookup | DNS record queries for SPF, DKIM, DMARC verification |\n| pyspf | Python SPF record validation library |\n| dkimpy | Python DKIM signature verification library |\n| PhishTool | Specialized phishing email analysis platform |\n| VirusTotal | URL and file reputation checking service |\n| AbuseIPDB | IP address reputation database |\n| whois | Domain registration information lookup |\n\n## Common Scenarios\n\n**Scenario 1: CEO Fraud \u002F Business Email Compromise**\nThe email claims to be from the CEO but Reply-To points to a Gmail address, SPF fails because the sending IP is not authorized for the spoofed domain, DKIM is missing, and the From domain is a lookalike (ceo-company.com vs company.com).\n\n**Scenario 2: Credential Harvesting Phishing**\nEmail contains a link that displays \"login.microsoft.com\" but href points to a lookalike domain, the attachment is an HTML file containing a fake login page with credential exfiltration JavaScript, the sending domain was registered 3 days ago.\n\n**Scenario 3: Malware Delivery via Attachment**\nEmail with an Office document attachment containing macros, the sender domain passes SPF but the account was compromised, DKIM signature is valid (sent from legitimate infrastructure), attachment SHA-256 matches known malware on VirusTotal.\n\n**Scenario 4: Spear Phishing with Legitimate Service**\nAttacker uses a legitimate email marketing service to send phishing, SPF and DKIM pass because the service is authorized, the phishing is in the content not the infrastructure, requires URL and content analysis rather than header authentication checks.\n\n## Output Format\n\n```\nEmail Header Analysis Report:\n  Subject:     \"Urgent: Invoice Payment Required\"\n  From:        accounting@examp1e-corp.com (SPOOFED)\n  Reply-To:    payments.urgent@gmail.com (MISMATCH)\n  Return-Path: \u003Cbounce@mail-server.xyz>\n  Date:        2024-01-15 09:23:45 UTC\n\n  Delivery Path (4 hops):\n    Hop 1: mail-server.xyz [203.0.113.45] -> relay1.isp.com\n    Hop 2: relay1.isp.com -> mx.target-company.com\n    Hop 3: mx.target-company.com -> internal-filter.target.com\n    Hop 4: internal-filter.target.com -> mailbox\n\n  Authentication:\n    SPF:    FAIL (203.0.113.45 not authorized for examp1e-corp.com)\n    DKIM:   NONE (no signature present)\n    DMARC:  FAIL (p=none, no enforcement)\n\n  Indicators of Phishing:\n    - Lookalike domain (examp1e-corp.com vs example-corp.com, 96% similar)\n    - From\u002FReply-To mismatch\n    - Domain registered 2 days before email sent\n    - URL in body points to credential harvesting page\n    - Attachment: invoice.xlsm (SHA-256: a3f2...) - Known malware on VT\n\n  Risk Level: HIGH\n```\n","> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Analyzing Email Headers for Phishing Investigation\n\n## When to Use\n- When investigating a suspected phishing email to determine its true origin\n- For verifying sender authenticity and detecting email spoofing\n- During incident response when a user has clicked a phishing link\n- When tracing the delivery path and relay servers of a suspicious email\n- For validating SPF, DKIM, and DMARC alignment to identify forgery\n\n## Prerequisites\n- Raw email headers from the suspicious message (EML or MSG format)\n- Understanding of SMTP protocol and email header fields\n- Access to DNS lookup tools (dig, nslookup) for SPF\u002FDKIM\u002FDMARC verification\n- Email header analysis tools (MHA, emailheaders.net concepts)\n- Python with email parsing libraries for automated analysis\n- Access to threat intelligence platforms for IP\u002Fdomain reputation\n\n## Workflow\n\n### Step 1: Extract Raw Email Headers\n\n```bash\n# Export from Outlook: Open email > File > Properties > Internet Headers\n# Export from Gmail: Open email > Three dots > Show original\n# Export from Thunderbird: View > Message Source\n\n# If working with EML file from forensic image\ncp \u002Fmnt\u002Fevidence\u002FUsers\u002Fsuspect\u002FAppData\u002FLocal\u002FMicrosoft\u002FOutlook\u002Fphishing_email.eml \\\n   \u002Fcases\u002Fcase-2024-001\u002Femail\u002F\n\n# If working with PST file, extract individual messages\npip install pypff\npython3 \u003C\u003C 'PYEOF'\nimport pypff\n\npst = pypff.file()\npst.open(\"\u002Fcases\u002Fcase-2024-001\u002Femail\u002Foutlook.pst\")\nroot = pst.get_root_folder()\n\ndef extract_messages(folder, path=\"\"):\n    for i in range(folder.get_number_of_sub_messages()):\n        msg = folder.get_sub_message(i)\n        headers = msg.get_transport_headers()\n        subject = msg.get_subject()\n        if headers:\n            filename = f\"\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fmsg_{i}_{subject[:30]}.txt\"\n            with open(filename, 'w') as f:\n                f.write(headers)\n    for i in range(folder.get_number_of_sub_folders()):\n        extract_messages(folder.get_sub_folder(i))\n\nextract_messages(root)\nPYEOF\n```\n\n### Step 2: Parse the Email Header Chain\n\n```bash\n# Parse headers using Python email library\npython3 \u003C\u003C 'PYEOF'\nimport email\nfrom email import policy\n\nwith open('\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fphishing_email.eml', 'r') as f:\n    msg = email.message_from_file(f, policy=policy.default)\n\nprint(\"=== KEY HEADER FIELDS ===\")\nprint(f\"From:          {msg['From']}\")\nprint(f\"To:            {msg['To']}\")\nprint(f\"Subject:       {msg['Subject']}\")\nprint(f\"Date:          {msg['Date']}\")\nprint(f\"Message-ID:    {msg['Message-ID']}\")\nprint(f\"Reply-To:      {msg['Reply-To']}\")\nprint(f\"Return-Path:   {msg['Return-Path']}\")\nprint(f\"X-Mailer:      {msg['X-Mailer']}\")\nprint(f\"X-Originating-IP: {msg['X-Originating-IP']}\")\n\nprint(\"\\n=== RECEIVED HEADERS (bottom-up = chronological) ===\")\nreceived_headers = msg.get_all('Received')\nif received_headers:\n    for i, header in enumerate(reversed(received_headers)):\n        print(f\"\\nHop {i+1}: {header.strip()}\")\n\nprint(\"\\n=== AUTHENTICATION RESULTS ===\")\nauth_results = msg.get_all('Authentication-Results')\nif auth_results:\n    for result in auth_results:\n        print(result)\n\nprint(f\"\\nARC-Authentication-Results: {msg.get('ARC-Authentication-Results', 'Not present')}\")\nprint(f\"Received-SPF: {msg.get('Received-SPF', 'Not present')}\")\nprint(f\"DKIM-Signature: {msg.get('DKIM-Signature', 'Not present')}\")\nPYEOF\n```\n\n### Step 3: Validate SPF, DKIM, and DMARC Records\n\n```bash\n# Extract the envelope sender domain\nSENDER_DOMAIN=\"example-corp.com\"\n\n# Check SPF record\ndig TXT $SENDER_DOMAIN +short | grep \"v=spf1\"\n# Example: \"v=spf1 include:_spf.google.com include:sendgrid.net ~all\"\n\n# Check DKIM record (selector from DKIM-Signature header, e.g., \"s=selector1\")\nDKIM_SELECTOR=\"selector1\"\ndig TXT ${DKIM_SELECTOR}._domainkey.${SENDER_DOMAIN} +short\n\n# Check DMARC record\ndig TXT _dmarc.${SENDER_DOMAIN} +short\n# Example: \"v=DMARC1; p=reject; rua=mailto:dmarc@example-corp.com; pct=100\"\n\n# Verify the sending IP against SPF\n# Extract IP from first Received header\nSENDING_IP=\"203.0.113.45\"\n\n# Manual SPF check using python\npython3 \u003C\u003C 'PYEOF'\nimport spf  # pip install pyspf\n\nresult, explanation = spf.check2(\n    i='203.0.113.45',\n    s='sender@example-corp.com',\n    h='mail.example-corp.com'\n)\nprint(f\"SPF Result: {result}\")\nprint(f\"Explanation: {explanation}\")\n# Results: pass, fail, softfail, neutral, none, temperror, permerror\nPYEOF\n\n# Check if sending IP is in known malicious IP lists\n# Query AbuseIPDB or VirusTotal\ncurl -s \"https:\u002F\u002Fapi.abuseipdb.com\u002Fapi\u002Fv2\u002Fcheck?ipAddress=${SENDING_IP}\" \\\n   -H \"Key: YOUR_API_KEY\" -H \"Accept: application\u002Fjson\" | python3 -m json.tool\n```\n\n### Step 4: Analyze Sender Domain and Infrastructure\n\n```bash\n# WHOIS lookup on sender domain\nwhois $SENDER_DOMAIN | grep -iE '(registrar|creation|expiration|registrant|nameserver)'\n\n# Check domain age (recently registered domains are suspicious)\n# DNS record investigation\ndig A $SENDER_DOMAIN +short\ndig MX $SENDER_DOMAIN +short\ndig NS $SENDER_DOMAIN +short\n\n# Reverse DNS on sending IP\ndig -x $SENDING_IP +short\n\n# Check for lookalike\u002Ftyposquatting domains\n# Compare with legitimate domain using visual similarity\npython3 \u003C\u003C 'PYEOF'\nimport Levenshtein  # pip install python-Levenshtein\n\nlegitimate = \"microsoft.com\"\nsuspicious = \"micr0soft.com\"\n\ndistance = Levenshtein.distance(legitimate, suspicious)\nratio = Levenshtein.ratio(legitimate, suspicious)\nprint(f\"Edit distance: {distance}\")\nprint(f\"Similarity ratio: {ratio:.2%}\")\nif ratio > 0.8:\n    print(\"WARNING: Likely typosquatting\u002Flookalike domain!\")\nPYEOF\n\n# Check domain reputation on VirusTotal\ncurl -s \"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fdomains\u002F${SENDER_DOMAIN}\" \\\n   -H \"x-apikey: YOUR_VT_API_KEY\" | python3 -m json.tool\n\n# Check if the Reply-To differs from From (common phishing indicator)\npython3 -c \"\nimport email\nwith open('\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fphishing_email.eml') as f:\n    msg = email.message_from_file(f)\nfrom_addr = email.utils.parseaddr(msg['From'])[1]\nreply_to = email.utils.parseaddr(msg.get('Reply-To', msg['From']))[1]\nif from_addr != reply_to:\n    print(f'WARNING: From ({from_addr}) != Reply-To ({reply_to})')\nelse:\n    print('From and Reply-To match')\n\"\n```\n\n### Step 5: Examine Email Body and Attachments\n\n```bash\n# Extract URLs from email body\npython3 \u003C\u003C 'PYEOF'\nimport email\nimport re\nfrom email import policy\n\nwith open('\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fphishing_email.eml', 'r') as f:\n    msg = email.message_from_file(f, policy=policy.default)\n\nbody = msg.get_body(preferencelist=('html', 'plain'))\nif body:\n    content = body.get_content()\n    urls = re.findall(r'https?:\u002F\u002F[^\\s\u003C>\"\\']+', content)\n    print(\"=== URLs FOUND IN EMAIL BODY ===\")\n    for url in set(urls):\n        print(f\"  {url}\")\n\n    # Check for URL obfuscation (display text != href)\n    href_pattern = re.findall(r'\u003Ca[^>]*href=[\"\\']([^\"\\']+)[\"\\'][^>]*>(.*?)\u003C\u002Fa>', content, re.DOTALL)\n    print(\"\\n=== HYPERLINK ANALYSIS ===\")\n    for href, text in href_pattern:\n        display_url = re.findall(r'https?:\u002F\u002F[^\\s\u003C]+', text)\n        if display_url and display_url[0] != href:\n            print(f\"  MISMATCH: Display='{display_url[0]}' -> Actual='{href}'\")\n\n# Extract and hash attachments\nprint(\"\\n=== ATTACHMENTS ===\")\nfor part in msg.walk():\n    if part.get_content_disposition() == 'attachment':\n        filename = part.get_filename()\n        content = part.get_payload(decode=True)\n        import hashlib\n        sha256 = hashlib.sha256(content).hexdigest()\n        print(f\"  File: {filename}, Size: {len(content)}, SHA-256: {sha256}\")\n        with open(f'\u002Fcases\u002Fcase-2024-001\u002Femail\u002Fattachments\u002F{filename}', 'wb') as af:\n            af.write(content)\nPYEOF\n\n# Submit attachment hashes to VirusTotal\n# Submit URLs to URLhaus or PhishTank for reputation check\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| SPF (Sender Policy Framework) | DNS record specifying authorized mail servers for a domain |\n| DKIM (DomainKeys Identified Mail) | Cryptographic signature verifying email content integrity |\n| DMARC | Policy framework combining SPF and DKIM for sender authentication |\n| Received headers | Server-added headers showing each hop in the delivery chain (read bottom to top) |\n| Return-Path | Envelope sender address used for bounce messages; may differ from From |\n| Message-ID | Unique identifier assigned by the originating mail server |\n| X-Originating-IP | Original sender IP address (added by some mail services) |\n| Header forgery | Attackers can forge From, Reply-To, and other headers but not Received chains |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| MXToolbox | Online email header analyzer and DNS lookup |\n| dig\u002Fnslookup | DNS record queries for SPF, DKIM, DMARC verification |\n| pyspf | Python SPF record validation library |\n| dkimpy | Python DKIM signature verification library |\n| PhishTool | Specialized phishing email analysis platform |\n| VirusTotal | URL and file reputation checking service |\n| AbuseIPDB | IP address reputation database |\n| whois | Domain registration information lookup |\n\n## Common Scenarios\n\n**Scenario 1: CEO Fraud \u002F Business Email Compromise**\nThe email claims to be from the CEO but Reply-To points to a Gmail address, SPF fails because the sending IP is not authorized for the spoofed domain, DKIM is missing, and the From domain is a lookalike (ceo-company.com vs company.com).\n\n**Scenario 2: Credential Harvesting Phishing**\nEmail contains a link that displays \"login.microsoft.com\" but href points to a lookalike domain, the attachment is an HTML file containing a fake login page with credential exfiltration JavaScript, the sending domain was registered 3 days ago.\n\n**Scenario 3: Malware Delivery via Attachment**\nEmail with an Office document attachment containing macros, the sender domain passes SPF but the account was compromised, DKIM signature is valid (sent from legitimate infrastructure), attachment SHA-256 matches known malware on VirusTotal.\n\n**Scenario 4: Spear Phishing with Legitimate Service**\nAttacker uses a legitimate email marketing service to send phishing, SPF and DKIM pass because the service is authorized, the phishing is in the content not the infrastructure, requires URL and content analysis rather than header authentication checks.\n\n## Output Format\n\n```\nEmail Header Analysis Report:\n  Subject:     \"Urgent: Invoice Payment Required\"\n  From:        accounting@examp1e-corp.com (SPOOFED)\n  Reply-To:    payments.urgent@gmail.com (MISMATCH)\n  Return-Path: \u003Cbounce@mail-server.xyz>\n  Date:        2024-01-15 09:23:45 UTC\n\n  Delivery Path (4 hops):\n    Hop 1: mail-server.xyz [203.0.113.45] -> relay1.isp.com\n    Hop 2: relay1.isp.com -> mx.target-company.com\n    Hop 3: mx.target-company.com -> internal-filter.target.com\n    Hop 4: internal-filter.target.com -> mailbox\n\n  Authentication:\n    SPF:    FAIL (203.0.113.45 not authorized for examp1e-corp.com)\n    DKIM:   NONE (no signature present)\n    DMARC:  FAIL (p=none, no enforcement)\n\n  Indicators of Phishing:\n    - Lookalike domain (examp1e-corp.com vs example-corp.com, 96% similar)\n    - From\u002FReply-To mismatch\n    - Domain registered 2 days before email sent\n    - URL in body points to credential harvesting page\n    - Attachment: invoice.xlsm (SHA-256: a3f2...) - Known malware on VT\n\n  Risk Level: HIGH\n```\n",{"hide":49,"name":5,"source":50,"license":15,"description":7,"authorized_lab":45,"origin_frontmatter":51},true,"mukul975\u002FAnthropic-Cybersecurity-Skills","name: analyzing-email-headers-for-phishing-investigation | description: Parse and analyze email headers to trace the origin of phishing emails, |   verify sender authenticity, and identify spoofing through SPF, DKIM, and DMARC validation. | domain: cybersecurity | subdomain: digital-forensics | tags: | - forensics | - email-analysis | - phishing | - spf | - dkim | - dmarc | - header-analysis | version: '1.0' | author: mahipal | license: Apache-2.0 | atlas_techniques: | - AML.T0052 | nist_csf: | ","main","4c6d8d65f3d6096e2fc25b0845e481dda73c2794",".claude\u002Fskills\u002Fcyber-analyzing-email-headers-for-phishing-investigation",0,"https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions","Building deterministic AI governance and continuity systems. Workflow architect + visual storyteller","2026-11-14 03:05:17",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":49},[62,65,68],{"tool":63,"command":64},"npx","npx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-analyzing-email-headers-for-phishing-investigation",{"tool":66,"command":67},"bunx","bunx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-analyzing-email-headers-for-phishing-investigation",{"tool":69,"command":70},"pnpm","pnpm dlx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-analyzing-email-headers-for-phishing-investigation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-analyzing-email-headers-for-phishing-investigation\u002FSKILL.md",[],[74,98,121,146,175,194],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":44},"01M71CG1AME5WC0A79AE65WT0X","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","MIT","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],"zoom out","zoom","with","harness","how","section","re","true","understand","use","perspective","when","you","code","it","context",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":44},"01M71CFY9ATD0BAXV6B14HFG7C","yuri-shura","6-perspective adversarial review for high-stakes turns (architecture decisions, refactor planning, deployment review) — fans out architect, adversary (7-vector attack), maintainer, ops, product, and security perspectives in parallel, then consolidates. Use when user says 'review this decision', '\u002Fshura', 'adversarial review', 'what could go wrong', 'architecture review', or 'deployment review'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-shura\u002FSKILL.md",[],[105,106,85,107,108,28,109,110,111,112,113,91,114,93,115,116,117,118,119,120],"yuri shura","parallel","architecture review","planning","deployment","vector","strategic review","decision","strategic","ops","workflow","decisions","architecture","review","perspectives","adversarial",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":128,"publishedAt":44},"01M71CFTTYW1HA2MNX38EV1GJ5","yuri-sales-intelligence","Unified sales and outreach skill generating cold outreach openers, social selling sequences, objection rebuttals, and ad creative for any paid platform — multi-persona aware, adapting tone and offer frame to buyer type. Use when user says 'write a cold email', 'outreach sequence', 'objection handling', 'ad copy', or 'sales pitch'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-sales-intelligence\u002FSKILL.md",[127],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[129,130,131,132,133,134,135,136,137,93,138,139,140,141,142,143,27,28,144,145],"intelligence","sales intelligence","yuri sales intelligence","sales","cold","paid","social","persona","pitch","cold email","ad creative","write","sequences","sequence","platform","cold outreach","frame",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":160,"publishedAt":44},"01M71CFQMBFTFADJNGP0Z2WCYK","yuri-code-intelligence","Unified code quality intelligence layer that diagnoses code smells (Long Method, Feature Envy, design pattern issues), prescribes targeted Fowler refactoring techniques, and reviews code for security, performance, and clarity. Use when user says 'review this code', 'refactor this', 'what's wrong with this method', 'code smells', or 'clean this up'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-code-intelligence\u002FSKILL.md",[152,155],{"categoryNo":153,"categoryName":154,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":156,"categoryName":157,"taxonomyType":158,"taxonomyTypeDesc":159},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[161,95,162,129,85,163,164,165,28,166,167,168,169,170,171,172,173,174,91,93],"yuri code intelligence","code intelligence","reviews","code quality","feature","performance","code review","long","up","issues","clean","techniques","improve","design",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":44},"01M71CFP32RT6GD3GKNHCJP8VP","yuri-adw","Invoke when user asks to run the ADW loop \u002F agentic engineering loop \u002F software factory workflow.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-adw\u002FSKILL.md",[],[182,183,184,185,186,187,188,189,190,93,191,115,192,193],"yuri adw","run","engineering loop","software factory","software","agentic engineering","factory","loop","invoke","engineering","agentic","user",{"skillNo":195,"name":196,"nameZh":6,"description":197,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":198,"categories":199,"keywords":212,"publishedAt":44},"01M71CFK4VPEKY6A73237P7RSN","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[200,203,206,209],{"categoryNo":201,"categoryName":202,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":204,"categoryName":205,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":207,"categoryName":208,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":210,"categoryName":211,"taxonomyType":158,"taxonomyTypeDesc":159},"01JBSEEDCAT000000000000036","内容创作者",[213,214,215,93,115,216,85,217,109,91,218],"writing","writing skills","new","work","editing","Existing"]