Two XSS Vulnerabilities in Azure with Embedded postMessage IFrames
Two Azure services, Azure Bastion and Azure Container Registry, embedded attacker-controlled endpoints in iframes and accepted postMessages without properly validating their origin or sanitising SVG content, allowing an attacker to run script in the victim's session. This could give unauthorised access to the victim's session within the affected Azure service.
Published on orca.security
Microsoft Azure offers a diverse range of services that empower organizations with convenient and scalable cloud infrastructure solutions. However, even robust systems can fall victim to security vulnerabilities that require prompt identification and mitigation.
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 postMessage handlers did not properly validate the message origin and did not sanitise SVG content before rendering it, so attacker-supplied data reached a script execution sink.
Impact
An attacker could gain unauthorised access to the victim's session within the compromised Azure service, potentially leading to data access, modification or disruption, though the sandbox's missing allow-modals attribute blocked simple alert pop-ups.
What the attacker needed
Victim clicks an attacker link; attacker-controlled endpoint; Azure Bastion service in use
The fix
Microsoft fixed both vulnerabilities in the Azure infrastructure after reproducing them.
How it was found
- Set up an Azure Bastion service and open the Connect option.
- Connect without opening a new tab so the Bastion host page is embedded in an iframe.
- Replace the endpoint in the connection URL with an attacker-controlled server and confirm it is embedded.
- Run a Connection Troubleshoot test and switch to the Topology View.
- Modify the postMessage that renders the topology graph so it contains a malicious script.
- Send the modified postMessage and observe that the script executes.
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.
A web page can include another page inside a frame, and those pages can send each other messages. If the receiving page trusts messages from anywhere and puts their content on screen without cleaning it, an attacker can make the victim's browser run the attacker's code. That code then acts as the victim inside the Azure service.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.