SVG files look like images to users and to many mail filters, but they are XML documents that a browser will happily execute as active content. Attackers use that gap to deliver credential phishing pages, redirects and locally assembled malware inside an attachment that appears to be a harmless picture or a "PDF". This guide explains why SVG can carry script, how SVG lures work at a high level, and the concrete policy, browser, endpoint and detection controls that stop them. It is written for email security administrators and SOC analysts. It is defensive only and contains no working SVG content.
Key takeaways
- SVG is a document format, not just an image. The SVG specification defines a script element and "on" event attributes on every element, so a browser that opens an SVG directly can run its JavaScript.
- Default attachment filters often miss it. In Microsoft Defender for Office 365, as of November 2026, svg is not in the default common attachments filter list or in the additional selectable list, so it passes unless you act. Check your own gateway the same way.
- Few businesses need inbound SVG attachments. For most organisations, blocking or quarantining external .svg attachments costs little; where designers need them, allow them only for named groups after sandboxing or conversion.
- The lure shape gives it away. A file named like a PDF or invoice with an .svg extension, a self-addressed message with recipients in BCC, and a redirect to a CAPTCHA page are strong signals that do not change when attackers rewrite the code.
- Assume some get through. Phishing-resistant MFA, browser reputation checks and application control limit the damage when a user opens one, and a simple reporting route turns users into an early warning system.
Why SVG files can carry active content
Scalable Vector Graphics is an XML vocabulary published by the W3C. Unlike PNG or JPEG, which hold pixel data, an SVG file is text that a renderer interprets, and that text can include more than shapes. Three features matter to defenders:
- The script element: SVG 2 describes it as the SVG equivalent of HTML's script element. Its default type is application/ecmascript, functions it defines have global scope across the document, and an href attribute can point to an external script.
- Event attributes: any attribute starting with "on" (for example onload or onclick) runs script when the matching event reaches its element, and these attributes are available on all SVG elements. A file can run code the moment it is rendered.
- Links and embedded content: the a element makes any shape a clickable hyperlink, and SVG can embed foreign content and data, so a file can draw a convincing "document preview" with a button that leads to a phishing site.
Context decides whether any of this runs. When an SVG is referenced from an HTML img element, browsers treat it as a static image and do not run its scripts. When the user opens the .svg file itself, the browser loads it as a top-level document and scripts and links are live. On most desktops the default application for .svg is a web browser, so double-clicking an email attachment is exactly the dangerous case.
MITRE ATT&CK tracks this as SVG Smuggling (T1027.017), noting that SVGs "may appear less suspicious to users than other types of executable files, as they are often treated as image files" and that the technique can be combined with HTML smuggling or embedded in PDFs. The delivery itself is Spearphishing Attachment (T1566.001). See the HTML Smuggling Guide for the closely related HTML technique.
How SVG phishing lures work (overview)
ATT&CK groups SVG smuggling content into four forms: content that assembles a payload, downloads a payload, redirects users to a malicious site, or displays interactive content such as fake login forms and download buttons. Two public cases show the range.
| Pattern | What the user sees | What happens | Example |
|---|---|---|---|
| Local payload assembly | An HTML attachment in a hijacked reply thread, showing a zip password | Script inside an embedded SVG rebuilds an encrypted zip in the browser and prompts the user to save it; the zip holds an ISO that installs malware | Cisco Talos reported this with QakBot in 2022, reusing an email thread from 2020 |
| Redirect to credential phishing | A "file shared with you" notice and an attachment named like a 6 page PDF, but ending in .svg | Opening it redirects to a CAPTCHA-style "security verification" page, the usual step before a fake sign-in page, with fingerprinting and session tracking | Microsoft Threat Intelligence, August 2025, sent from a compromised small business mailbox to itself with targets in BCC |
Two features make these lures hard for content scanners. The payload is built or decoded on the endpoint rather than downloaded over the network, which Talos noted helps it evade filters that inspect content in transit. Obfuscation is cheap: in the 2025 campaign Microsoft assessed that the script was probably written by a large language model and hid its payload in a sequence of business terms rather than standard encoding. Microsoft still blocked it using signals that do not depend on the code: the self-addressed BCC pattern, the misleading file type, the redirect to known phishing infrastructure, the presence of obfuscation and tracking behaviour. For the wider trend, see the AI-Generated Phishing Defence Guide.
Blocking and filtering options
Pick a default for external .svg attachments, then add exceptions. The options below are vendor-neutral; every mature gateway offers some version of each.
| Option | What it does | Strength | Cost and trade-off | Best fit |
|---|---|---|---|---|
| Block (reject with NDR or drop) | Rejects any message with an .svg attachment from external senders | Removes the vector completely; simple to explain and audit | Designers, marketing and print suppliers lose a common exchange format; an NDR tells the attacker the file was stopped | Most organisations, especially those with no design function |
| Quarantine (admin release only) | Holds the message; only administrators can release after review | Same protection as block, with a recovery path for genuine files | Release requests create work for the mail team; review must be done safely, not by opening the file on a workstation | Organisations with occasional legitimate SVG traffic |
| Convert or flatten (CDR) | Rebuilds the attachment without script, event attributes and links, or renders it to a raster image or PDF | Users still get the picture; active content is removed by design | Conversion can break complex graphics; raster output loses scalability; needs a product that supports SVG | Design teams that need to see artwork but not edit it |
| Sandbox (detonation) | Opens the file in an instrumented browser and blocks it if it redirects, loads script or contacts bad infrastructure | Catches redirect and phishing behaviour, including new infrastructure | Adds delivery delay; evasive code may check for sandboxes or require a click before acting | As an extra layer on allowed exceptions |
| Allow by group | Lets SVG through only to named recipients or from named partner domains | Keeps business flows working for those who need them | A partner mailbox compromise bypasses it, so combine with sandboxing or CDR | Agencies, publishers, product teams |
See Attachment Sandboxing vs CDR for a deeper comparison of the last three approaches.
Implementation notes
- Add svg to the attachment filter explicitly: do not assume it is covered. In Microsoft Defender for Office 365, the common attachments filter lists its default and selectable file types in the documentation, and neither list included svg when checked in November 2026. The filter's action is either "Reject the message with a non-delivery report (NDR)" (the default) or "Quarantine the message", and the default quarantine policy for malware, AdminOnlyAccessPolicy, has notifications off and lets recipients only request release. Settings in custom policies are ignored for users covered by the Standard or Strict preset policies, so check which policy actually applies.
- Match on content and name, not just extension: treat a file as SVG if the extension is .svg or .svgz, or the MIME type is image/svg+xml, or the file begins with XML and an svg root element. Flag double extensions and names that imitate other formats ("Invoice.pdf.svg", "PDF 6 pages").
- Look inside archives and HTML: SVG content often arrives inside a zip, inside an HTML attachment or embedded in a PDF. Make sure archive scanning is on and that HTML attachments face the same policy.
- Inline images: Microsoft announced in message centre post MC1130385 that Outlook on the web and the new Outlook for Windows stopped displaying inline SVG images from September 2025, while SVG images sent as classic attachments remain supported. The attachment route is still open, which is why the filter decision matters.
- Roll out in stages: run a two-week report-only rule first to count genuine SVG traffic by sender and recipient, agree exceptions with the business, then switch to quarantine and finally block. Roll back by changing the action back to quarantine, not by disabling the rule.
Browser and endpoint controls
Filtering will not catch everything, especially SVG arriving through file-sharing links, chat or a partner's compromised mailbox. These layers decide what happens when a user opens one.
- File association: where nobody needs to open SVG files locally, associate .svg with an image viewer that does not run script rather than the browser, through your endpoint management tool. Test first: design tools and some web developers will need the default changed back.
- Browser reputation and URL checks: keep the browser's built-in phishing and malware protection on (for example Microsoft Defender SmartScreen or Google Safe Browsing) and stop users turning it off by policy. Microsoft's mitigation list for the 2025 campaign included browsers with SmartScreen, Safe Links time-of-click checks and zero-hour auto purge to pull back delivered mail. See the Browser Security Hardening Guide.
- Web proxy and DNS filtering: the NCSC recommends blocking access to sites hosting malware or phishing campaigns with a proxy or protective DNS service. Newly registered domains and CAPTCHA interstitials are worth a category block or warning page.
- Application control: Talos's QakBot advice was to block obfuscated scripts, stop scripts from launching downloaded executables and enforce application control, because the SVG's end product was an ISO and an executable. See the App Control for Business (WDAC) guide.
- Phishing-resistant authentication: most SVG lures aim at credentials. FIDO2 passkeys or certificate-based sign-in make a harvested password far less useful. See the Phishing-Resistant MFA Guide.
- Applications that accept SVG uploads: if your own web apps display user-supplied SVG, sanitise it with a maintained sanitiser (OWASP recommends DOMPurify for HTML sanitisation and stresses keeping it updated), serve it from a separate domain and prefer displaying it through img tags, where scripts do not run.
Detection and hunting
Hunt for the delivery pattern first, then for what happened after the file was opened.
| Signal | Where to look | Why it matters |
|---|---|---|
| Inbound .svg attachments from external senders, by sender and recipient | Email gateway or mail trace logs (attachment file type, extension, file name) | Establishes a baseline; any delivery after a block decision is a policy gap |
| File names that imitate other formats (PDF, invoice, remittance, voicemail, "6 pages") | Attachment names in mail logs | The misleading file type was a key blocking signal in the 2025 campaign |
| Sender equals recipient with real recipients in BCC | Message headers and envelope data | A pattern used to slip past basic heuristics; rarely legitimate for external mail |
| Browser process opening a local .svg from a mail or download folder | EDR process and file events (browser with a file path argument ending in .svg) | Shows the user opened the attachment directly, the case where script runs |
| Browser navigation to a newly seen domain or CAPTCHA page seconds after that | Proxy, DNS and EDR network logs | Typical redirect chain towards a credential harvesting page |
| Archive or ISO written to disk by a browser after an SVG or HTML file opens | EDR file creation events | Indicates local payload assembly (smuggling) |
| Risky sign-in or new MFA method for the recipient soon after delivery | Identity provider sign-in and audit logs | Credentials may have been entered; trigger session revocation and a password reset |
When one message is confirmed, search for the same attachment hash, file name, sender infrastructure and landing domain across all mailboxes and purge it. If the sender is a genuine partner, tell them: their mailbox is probably compromised, as in the Microsoft case.
Metrics
- SVG delivery rate: external messages with .svg attachments delivered to inboxes per week. Target zero outside approved exceptions.
- Exception scope: number of recipients and partner domains allowed to receive SVG, reviewed quarterly.
- Time to purge: minutes from the first user report or detection to removal from all mailboxes.
- Report rate: share of simulated or real SVG lures reported by users, measured alongside clicks as the NCSC recommends.
- Post-click containment: percentage of confirmed opens followed by session revocation and credential reset within one hour.
User awareness points
Keep the message short and practical, and treat training as one layer, not the main defence.
- Check the real file type: a picture file (.svg) that claims to be a document, invoice or voicemail is a warning sign. Show users how to see the full extension on their device.
- An image should not ask you to sign in: if opening an attachment leads to a "verify you are human" page or a login screen, close it and report it.
- Self-addressed shares are odd: a "file shared with you" message where you are not in the To line deserves a second look.
- Report even after clicking: make reporting one click, give feedback, and never blame. In the NCSC case study, user reports, including some after clicks, were the first sign an attack had passed the filters.
- Use simulations carefully: include an SVG-style lure in your phishing simulation programme (see the Phishing Simulation Programme Guide), using a harmless file and the platform's safe landing page.
Framework mapping
| Framework | Reference | How it applies |
|---|---|---|
| MITRE ATT&CK | T1566.001 Spearphishing Attachment; T1027.017 SVG Smuggling; T1027.006 HTML Smuggling; T1204.002 Malicious File; T1059.007 JavaScript | Delivery, concealment and execution steps of an SVG lure |
| NIST SP 800-53 Rev. 5 | SI-3 Malicious Code Protection; SI-8 Spam Protection; SC-44 Detonation Chambers; SC-18 Mobile Code; AT-2 Literacy Training and Awareness | Attachment filtering, sandboxing, control of active content and user awareness |
| NIST CSF 2.0 | PR.PS-05; DE.CM-09; PR.AT-01 | Preventing unauthorised execution, monitoring endpoints and data, awareness |
| CIS Controls v8.1 | 9.6 Block Unnecessary File Types; 9.7 Deploy and Maintain Email Server Anti-Malware Protections | Adding svg to blocked attachment types and scanning mail |
| ISO/IEC 27001:2022 Annex A | A.8.7 Protection against malware; A.8.23 Web filtering; A.6.3 Information security awareness, education and training | Policy, filtering and training controls |
Common failure patterns
- Trusting the default list: assuming the gateway's built-in dangerous file list covers SVG because it covers scripts and executables.
- Extension-only rules: blocking .svg but not .svgz, image/svg+xml MIME parts, or SVG inside zip and HTML attachments.
- Wrong policy in force: editing a custom anti-malware policy while users are covered by a preset policy that ignores it.
- Unsafe release reviews: mail staff opening quarantined SVGs in their own browser to "check" them, instead of using a sandbox or a text view.
- Partner allow lists without inspection: letting all mail from a supplier domain through, so a compromised supplier mailbox delivers SVG lures straight to inboxes.
- Stopping at the mailbox: purging the message but not checking whether the recipient entered credentials, so the account stays exposed.
Practitioner checklist
- Confirm whether your gateway's attachment filter includes svg and svgz; add them if not.
- Run a report-only rule for two weeks to measure genuine SVG traffic before choosing block, quarantine or convert.
- Set the default for external SVG to block or admin-only quarantine; allow exceptions only to named groups with sandboxing or CDR.
- Make sure archive and HTML attachment scanning apply the same rule.
- Change the .svg file association to a non-scripting viewer where business use allows.
- Keep browser phishing protection, time-of-click URL checks and post-delivery purge switched on.
- Build hunts for misleading SVG file names, self-addressed BCC messages and browser opens of local .svg files.
- Link email detections to identity response: revoke sessions and reset credentials when a user may have signed in.
- Add SVG lures to awareness content and simulations, and measure reports as well as clicks.
Standards and references
- W3C: Scalable Vector Graphics (SVG) 2, Scripting and Interactivity
- MITRE ATT&CK: SVG Smuggling (T1027.017)
- MITRE ATT&CK: Spearphishing Attachment (T1566.001)
- NCSC: Phishing attacks, defending your organisation
- Microsoft Learn: Anti-malware protection in EOP, common attachments filter
- Microsoft Threat Intelligence: AI vs AI, detecting an AI-obfuscated phishing campaign
- Cisco Talos: HTML smugglers turn to SVG images
- OWASP: Cross Site Scripting Prevention Cheat Sheet
Related NHI Mgmt Group resources: Email Security Guide · HTML Smuggling Guide · Attachment Sandboxing vs CDR · How to Spot a Phishing Email Guide