Response playbooks, investigation guides, and Atomic Red Team tests are Pro-only. Upgrade to unlock the full detection package for THREAT-PGPEmail-AsymmetricEncryptedExfil.

Upgrade to Pro
THREAT-PGPEmail-AsymmetricEncryptedExfil

Data Exfiltration via PGP/GPG-Encrypted Email Attachments

Exfiltration Last updated:

Rather than pushing data to attacker-controlled infrastructure over SFTP/FTPS/HTTP (the channel used by purpose-built tools like StealBit and Exmatter), this sub-technique variant abuses a fully sanctioned, already-allowed corporate channel — outbound email through the organization's own mail server or SaaS mail platform (Exchange Online, Gmail) — by first encrypting the data with an asymmetric keypair (OpenPGP/GPG, or S/MIME) before attaching it. Because the ciphertext is opaque without the recipient's private key, content-based DLP, CASB, and email security gateways that rely on pattern/keyword/fingerprint matching over attachment contents cannot inspect what is being sent; they can only observe metadata (attachment extension, size, sender, recipient domain). This makes it an attractive technique for insiders exfiltrating IP to a personal or competitor mailbox, and has also been observed as a secondary channel by data-theft actors who encrypt staged archives with a public key before transfer specifically to prevent the victim organization, EDR/DLP vendor, or law enforcement from ever recovering the plaintext of what was stolen. Detection therefore has to pivot on the artifacts still visible around the encryption event: unusual attachment extensions (.gpg, .pgp, .asc, .p7m) or ASCII-armored PGP blocks, GPG/GPG4Win/Kleopatra process execution with encryption flags on a host with no prior legitimate PGP usage, importing an external party's public key immediately before using it, and bursts of such encrypted-attachment emails to external domains that exceed a single user's normal PGP-for-legitimate-purposes baseline (e.g., signing software releases, encrypting vendor communications).

What is THREAT-PGPEmail-AsymmetricEncryptedExfil Data Exfiltration via PGP/GPG-Encrypted Email Attachments?

Data Exfiltration via PGP/GPG-Encrypted Email Attachments (THREAT-PGPEmail-AsymmetricEncryptedExfil) maps to the Exfiltration tactic — the adversary is trying to steal data in MITRE ATT&CK.

This page provides production-ready detection logic for Data Exfiltration via PGP/GPG-Encrypted Email Attachments, covering the data sources and telemetry it touches: Microsoft Defender for Office 365 (EmailEvents, EmailAttachmentInfo), Microsoft Defender for Endpoint (DeviceProcessEvents). The queries below are rated high severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.

MITRE ATT&CK

Tactic
Exfiltration
Microsoft Sentinel / Defender
kusto
let InternalMailDomains = dynamic(["contoso.com"]); // replace with your organization's verified tenant domain(s)
let PgpExtensions = dynamic([".gpg", ".pgp", ".asc", ".p7m"]);
let GpgProcessNames = dynamic(["gpg.exe", "gpg2.exe", "gpg4win.exe", "kleopatra.exe"]);
let GpgEncryptFlags = dynamic(["--encrypt", "--recipient", "-r ", "-e "]);
let OutboundPgpAttachments = EmailEvents
| where Timestamp > ago(24h)
| where EmailDirection == "Outbound"
| join kind=inner (
    EmailAttachmentInfo
    | where Timestamp > ago(24h)
    | where FileName has_any (PgpExtensions)
  ) on NetworkMessageId
| extend RecipientDomain = tostring(split(RecipientEmailAddress, "@")[1])
| where RecipientDomain !in~ (InternalMailDomains);
// Signal 1: a single outbound email with an asymmetric-encrypted attachment sent to an external recipient
let PgpEmailExfil = OutboundPgpAttachments
| extend Actor = SenderFromAddress, Target = RecipientEmailAddress, Detail = FileName, Signal = "PgpEncryptedAttachmentOutbound", RiskScore = 80
| project Timestamp, Actor, Target, Detail, Signal, RiskScore;
// Signal 2: a burst of 3+ such emails from one sender within an hour — bulk staged exfiltration rather than a single ad hoc message
let BulkPgpAttachmentBurst = OutboundPgpAttachments
| summarize AttachmentCount = count(), UniqueRecipients = dcount(RecipientEmailAddress) by SenderFromAddress, bin(Timestamp, 1h)
| where AttachmentCount >= 3
| extend Actor = SenderFromAddress, Target = "(multiple)", Detail = strcat("AttachmentCount=", tostring(AttachmentCount), " UniqueRecipients=", tostring(UniqueRecipients)), Signal = "BulkPgpAttachmentBurst", RiskScore = 90
| project Timestamp, Actor, Target, Detail, Signal, RiskScore;
// Signal 3: GPG/GPG4Win/Kleopatra encryption invoked on an endpoint — the collection/encryption step that precedes the email send
let GpgEncryptRaw = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ (GpgProcessNames)
| where ProcessCommandLine has_any (GpgEncryptFlags);
let GpgEncryptInvoked = GpgEncryptRaw
| extend Actor = DeviceName, Target = AccountName, Detail = ProcessCommandLine, Signal = "GpgEncryptInvoked", RiskScore = 55
| project Timestamp, Actor, Target, Detail, Signal, RiskScore;
// Signal 4: an external party's public key is imported into the local keyring within 15 minutes before it is used to encrypt data — just-in-time exfiltration prep, especially for a user with no prior PGP usage history
let KeyImportRaw = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ (GpgProcessNames)
| where ProcessCommandLine has "--import"
| project ImportTime = Timestamp, DeviceName, AccountName;
let GpgKeyImportThenEncrypt = GpgEncryptRaw
| join kind=inner (KeyImportRaw) on DeviceName, AccountName
| where Timestamp - ImportTime between (0min .. 15min)
| extend Actor = DeviceName, Target = AccountName, Detail = ProcessCommandLine, Signal = "GpgKeyImportThenEncrypt", RiskScore = 70
| project Timestamp, Actor, Target, Detail, Signal, RiskScore;
union PgpEmailExfil, BulkPgpAttachmentBurst, GpgEncryptInvoked, GpgKeyImportThenEncrypt
| sort by RiskScore desc, Timestamp desc

Four-signal detection combining Microsoft Defender for Office 365 mail telemetry with Microsoft Defender for Endpoint process telemetry: (1) a single outbound email to an external domain carrying an attachment with a PGP/GPG or S/MIME extension (.gpg, .pgp, .asc, .p7m); (2) three or more such emails from the same sender within an hour, indicating bulk staged exfiltration; (3) GPG, GPG4Win, or Kleopatra invoked with encryption flags on an endpoint; (4) an external public key imported into the local GPG keyring within 15 minutes of that same key being used to encrypt data, a strong just-in-time exfiltration-prep indicator.

high severity medium confidence

Data Sources

Microsoft Defender for Office 365 (EmailEvents, EmailAttachmentInfo) Microsoft Defender for Endpoint (DeviceProcessEvents)

Required Tables

EmailEvents EmailAttachmentInfo DeviceProcessEvents

False Positives

  • Legitimate business use of PGP/GPG for signing or encrypting vendor communications, software release artifacts, or financial documents — build an allowlist of known business recipients/domains and users with a documented, recurring PGP usage pattern
  • Security or DevOps teams distributing GPG-encrypted credentials, API keys, or backup exports to external partners as an approved secrets-sharing workflow
  • Legal or compliance teams encrypting sensitive documents (M&A due diligence, privileged communications) for external counsel using S/MIME or PGP, which is expected and should be excluded once verified
  • Automated systems (CI/CD release signing, EDI/B2B integrations) that routinely invoke gpg.exe with --encrypt/--recipient as part of a scheduled, service-account-driven job

Sigma rule & cross-platform mapping

The detection logic for Data Exfiltration via PGP/GPG-Encrypted Email Attachments (THREAT-PGPEmail-AsymmetricEncryptedExfil) above is provided in a vendor-neutral form so you can deploy it on any SIEM. The same logic is shipped here as native KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the following logsource:

logsource:
  category: process_creation
  product: windows

Browse the community-maintained Sigma rules for this technique:


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Simulate GPG Encryption of a Staged Archive with an External Recipient Key

    Expected signal: Sysmon Event ID 1 for gpg.exe invoked with --quick-generate-key, --import, and --encrypt --recipient; Sysmon Event ID 11 for creation of test_pubkey.asc and staged_data.txt.gpg.

  2. Test 2Simulate Outbound Email of a PGP-Encrypted Attachment to an External Test Recipient

    Expected signal: EmailEvents record with EmailDirection=Outbound to the external test recipient; EmailAttachmentInfo record with FileName ending in .gpg.

  3. Test 3Simulate a Bulk Burst of PGP-Encrypted Attachment Emails

    Expected signal: Four EmailAttachmentInfo/DLP records within the same one-hour bin, each with a .gpg attachment from the same sender to external recipients.

  4. Test 4Simulate GPG4Win/Kleopatra Encryption on macOS via GPG Suite

    Expected signal: Endpoint process telemetry (EDR/Sysmon-for-Mac equivalent) for gpg invoked with --encrypt --recipient flags, and file-creation telemetry for staged_data.txt.gpg.

Unlock playbooks & atomic tests with Pro

Get the full detection package for THREAT-PGPEmail-AsymmetricEncryptedExfil — response playbook and atomic red team tests, plus investigation guidance and hunting queries.

df00tech Pro — £29/user/month

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections