Bypassing Safe Links in Exchange Online Advanced Threat Protection
Safe Links in Exchange Online Advanced Threat Protection rewrites URLs in inbound emails to protect users, but the author found two bypasses: URL obfuscation tricks that make a malicious URL appear to belong to a whitelisted domain, and blocking or redirecting requests from the Exchange Online Protection infrastructure so that Safe Links cannot check the URL. An attacker could thus deliver links to malware that Safe Links would not rewrite or block.
Published on emtunc.org
In this article I will go through my findings and analysis on the Safe Links feature of Microsoft’s Office 365 Exchange Online Advanced Threat Protection.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the URL parsing used for whitelist matching is naive and can be confused by userinfo or subdomain tricks, and the checking infrastructure can be blocked or redirected by the target server.
Impact
An attacker could bypass Safe Links protection and deliver links to malware that would not be rewritten or blocked, though this relies on the organisation having whitelisted domains or the attacker controlling the target server.
What the attacker needed
Safe Links enabled with whitelisted domains; attacker controls a domain; victim clicks a link
The fix
Microsoft should improve URL parsing to correctly identify the actual domain and should not rely solely on IP blocking or headers to distinguish its own traffic; the text does not state a fix was applied.
How it was found
- Add a domain to the Safe Links whitelist policy.
- Craft a URL that includes the whitelisted domain as a subdomain or in the userinfo portion.
- Send an email containing the crafted URL; Safe Links does not rewrite it.
- Alternatively, block or redirect requests from Exchange Online Protection IP ranges on the web server.
- Send an email with a link to the malicious file; Safe Links cannot check it and the link remains.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Safe Links is a security feature that checks links in emails before you click them. The author found that by writing a link in a tricky way, or by making the checking service unable to reach the website, the check can be avoided. This means a malicious link could get through without being flagged.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.