Full Page Caching Stored XSS Vulnerability
The concrete5 CMS, when full-page caching is enabled on a server that answers to any hostname, writes the attacker-supplied Host header into cached pages as the base URL. An attacker can poison the cache so that subsequent visitors are served pages with links pointing to the attacker's domain.
- Disclosed after 9 months
##Configuration
A concrete5 site running over https on a dedicated IP address. Or any situation where you're not doing name-based virtual hosting and the web server will answer to any hostname.
- You have full page caching enabled (likely just block output caching too).
- Doesn't matter if you have Canonical URLs set or not.
- In 5.7x you couldn't set [x] always render at canonical url if you want the site to always run over https (Seems that might be fixed in version 8).
##Exploit
To exploit it, the attacker just overrides their hosts file to point your desired url ex:
11.22.33.44 fake-site.com # with the ip of the real site that's running concrete5
Then run a link spider through the site. The result is every page cache file that's generated gets stored with that fake fake-site.com url in any local links allowing the page to be rendered to subsequent visitors with the fake-site.com value as the BASE_URL.
I believe you can farther exploit this by writing code to detect the expiration time and verify that full page caching is enabled by reading the " Expires" http response header, to get the expiration time of the cache file, then hit that page again at the appropriate time.
##Fix
We should be able to fix it by requiring that a canonical url is set when certain caching options are enabled. Then make sure only that value is written when generating the cache files. Another option would be to write internal links as relative links to the cache files. Another option would be to just give up and melt crayons on the server's cpu.
##Existing Installs
Recommend that either full-page caching is not used on SSL or non name-based virtual hosting setups that would not restrict rendering of the site based on the hostname headers.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application builds absolute links from the request's Host header and stores them in the page cache without validating against a configured canonical URL.
Impact
Visitors could be served cached pages with links pointing to the attacker's domain, when full-page caching is on and the server answers to any hostname.
What the attacker needed
Full-page caching enabled; server answers to any hostname; attacker can modify hosts file
The fix
The text suggests requiring a canonical URL when caching is enabled and writing only that value into cache files, or using relative links; it does not state that a fix was applied.
How it was found
- Override the hosts file to point a chosen domain to the real site's IP address.
- Run a link spider through the site to generate cache files.
- The cache files are stored with the fake domain in local links.
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 report has not been written yet. The Original tab links to the source.
A website can be reached by different names (hostnames). This CMS saved pages in its cache using whatever name the visitor used. An attacker used a fake name, so the saved pages told later visitors to go to the attacker's site instead.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.