On this page:
Attack Spotlight
March 6, 2025
Credential phishing with nested attachments and a base64-encoded attack within an iframe
Sublime’s Attack Spotlight series is designed to keep you informed of the email threat landscape by showing you real, in-the-wild attack samples, describing adversary tactics and techniques, and explaining how they’re detected. These attacks can be prevented with a free Sublime account.
EMAIL PROVIDER: Microsoft 365
ATTACK TYPE: Credential Phishing
Last week’s Attack Spotlight looked at SVG attachments containing malicious code. The same day we posted that blog, we also launched a few new platform features, including the beta.scan_base64
function that identifies base64-encoded strings within text content and decodes them into readable strings. One of the key use cases for this functionality is analyzing HTML attachments for encoded data.
A few days later, the stars aligned and we saw a credential phishing attack featuring an EML attachment used to hide an SVG file that contained a base64-encoded attack within an iframe. Here’s how the attack worked:
We’ve covered both EML- and SVG-based attacks in previous blogs. What makes this attack interesting is the numerous layers of evasion.
Sublime’s file.explode
enrichment function performs data collection and/or file extraction on attachments. In the case of this message, recursive file explosions first identified the SVG within the EML, and then the base64-encoded attack within the SVG:
The beta.scan_base64 enrichment then decodes that text to reveal an HTML document that will be used to launch the attack.
This HTML then contained a portion of code with custom encoding, further hiding the attack type. At this point, there are more than enough signals for Sublime to label this message as malicious. But Sublime’s Detection team wanted to dig deeper.
Using the obfuscation code provided right within the HTML, we built a de-obfuscation function to identify the value of varcdcxho
. Here’s how we did it:
import re
def deobfuscate(encoded_str):
try:
# Step 1: Remove unwanted characters (xqzmv)
cleaned_str = re.sub(r"[xqzmv]", "", encoded_str)
# Step 2: Reverse the string before splitting
reversed_str = cleaned_str[::-1]
# Step 3: Extract hex values
hex_values = reversed_str.split("-")
# Step 4: Convert hex values into chars
decoded_chars = []
for h in hex_values:
try:
decimal_value = (int(h, 16) - 7) // 3 # Use Math to crush evil
# Ensure it's a valid ASCII character
if 32 <= decimal_value <= 126:
decoded_chars.append(chr(decimal_value))
except ValueError:
continue # Skip invalid hex values
# Step 5: Join the decoded output
decoded_url = "".join(decoded_chars).strip()
return decoded_url
except Exception as e:
return f"Decoding error: {str(e)}"
# naughty strings
encoded_str = "eb-eb-af-d21-961-1f-e41-bqe-661-901-[very redacted]"
# do it
final_url = deobfuscate(encoded_str)
# win
print(f"Deobfuscated URL: {final_url}")
This de-obfuscation gave us the attack URL, which was hosted on compromised infrastructure that has since been remediated. Combining all the tactics within this attack, we saw:
All that was to phish credentials, highlighting the length attackers will go, the novel approaches they’ll apply, and most importantly, the perceived value of your login credentials.
Sublime's AI-powered detection engine flagged this message as malicious. The top signals in this attack are:
Additionally, the Attachment: EML with Embedded Javascript in SVG file (unsolicited) Detection Rule includes the beta.scan_base64
enrichment to detect this type of attack.
And a special shout out to Kevin K. in the Sublime Community Slack for being the first person to let us know they’re using the new beta.scan_base64
enrichment 🎉🎉🎉
Sublime detects and prevents smuggled and encoded email-based threats. Start your free account today, in the cloud or self-hosted, for out-of-the-box coverage for these types of attacks with the ability to customize their handling for your environment.
Read more Attack Spotlights:
Sublime releases, detections, blogs, events, and more directly to your inbox.
The latest research, attack spotlights, and product updates.
Experience Sublime’s adaptable email security platform and take control of your email environment today.