{"vuid":"VU#335217","idnumber":"335217","name":"Content Delivery Networks handle HTTP headers in different and unexpected ways","keywords":["HTTP","headers","cache poisoning"],"overview":"A Content Delivery Network  (CDN) is a distributed network of proxy servers that deliver web content collected from a back end web server using a temporary local storage called a cache. HTTP cache poisoning is a type of attack that allows a remote attacker to inject arbitrary content using unsanitized HTTP headers to poison the remote cache of a CDN. Once an attacker has successfully injected malicious content, future visitors accessing the compromised website will collect and execute the attacker’s injected scripts.","clean_desc":"CDNs use HTTP caching software to provide high availability and high performance by distributing the service spatially relative to end-users. The HTTP caching software interprets the HTTP request from a website visitor(web client)using the supplied HTTP headers to select and deliver appropriate content. The content can either be delivered from the local cache or collected by reaching the appropriate back end web servers. This vulnerability works by sending arbitrary headers into the HTTP request stream,which may be processed by the back end web server or by the HTTP caching software. If either the web server or the HTTP caching software is vulnerable,it will include the attackers injected content in the response without performing any type of sanitization. Once the attacker's malicious content is returned,it will also be cached by the HTTP caching software. The HTTP caching software will continue to serve the malicious content to all future visitors of the website until the cache expires or is deleted. This allows the attacker to inject arbitrary content once and have multiple future visitors of the CDN hosted website collect the attacker's content and execute unwanted scripts. HTTP header injection using traditional headers,like the Host header and X-Forwarded-Host header,is not a new attack method. New HTTP headers like X-Forwarded-Proto,Referer,Upgrade-Insecure-Requests,and X-DNS-Prefetch-Control have been created to provide more capabilities for HTTP processing. Cloud caching in addition to newly available headers allows for an increase in prolonged,large scale attacks against busy and popular websites. Some examples of the vulnerable headers are: Content-Security-Policy-Report-Only Forwarded Server-Timing Set-Cookie Strict-Transport-Security X-Forwarded-Proto Location Accept-Language Cookie X-Forwarded-For X-Forwarded-Host Referer Max-Forwards There are at least two common reasons why these attacks are possible: 1. Certain HTTP headers(e.g.,X-Forwarded-Host)are sent by the reverse proxy or CDN to the web server and are many times presumed to be generated/modified by the CDN and therefore trusted. 2. Certain HTTP headers(e.g.,User-Agent)are not sanitized by the CDN before being delivered to the web server.","impact":"By performing a malicious request using HTTP headers, an attacker could poison the cache of an CDN provider and inject malicious content that will affect multiple future visitors of the website.","resolution":"CDN service providers should implement both of these recommendations: 1. CDNs should inspect and sanitize headers using appropriate enforcement and strict adherence to applicable RFCs before forwarding theses headers to back end web servers. 2. CDNs should also replace, remove, or append headers after sanitiziation that are submitted by the client but are expected to be generated or validated by the CDN, such as the X-Forwarded-Host header. Back end web servers should not trust any content sent as part of the HTTP request. Web servers should implement secure encoding of output appropriate for the common context targets in web applications (e.g. HTML, XML, JavaScript, etc) as recommended by OWASP.","workarounds":"As a work around, caching software providers can disable caching when suspicious content is found in the HTTP headers or the body of the HTTP requests. This prevents the storing and distributing of malicious content to all visitors of a website. Back end web server administrators can use the appropriate Cache-Control and Expiry headers to avoid caching of dynamically generated content by the CDNs. This will prevent the storage and delivery of malicious content to future visitors.","sysaffected":"","thanks":"Thanks to Dr. Mingkui Wei from Cyber Forensic Intelligence Center,Computer Science,Sam Houston State University for reporting this vulnerability. We would also like to acknowledge the prior research completed by Carlos Bueno and James Kettle.","author":"This document was written by Vijay S Sarvepalli.","public":["http://carlos.bueno.org/2008/06/host-header-injection.html","https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html","https://portswigger.net/research/practical-web-cache-poisoning","https://hostoftroubles.com","https://www.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_HTTP_Request/Response_Smuggling","https://www.owasp.org/index.php/Cache_Poisoning","https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html","https://dl.acm.org/citation.cfm?id=2978394"],"cveids":[""],"certadvisory":"","uscerttechnicalalert":null,"datecreated":"2019-08-30T13:19:42Z","publicdate":"2020-01-14T00:00:00Z","datefirstpublished":"2020-01-14T19:27:53Z","dateupdated":"2020-01-14T19:27:54Z","revision":63,"vrda_d1_directreport":"1","vrda_d1_population":"","vrda_d1_impact":"","cam_widelyknown":"0","cam_exploitation":"0","cam_internetinfrastructure":"0","cam_population":"0","cam_impact":"0","cam_easeofexploitation":"0","cam_attackeraccessrequired":"0","cam_scorecurrent":"0","cam_scorecurrentwidelyknown":"0","cam_scorecurrentwidelyknownexploited":"0","ipprotocol":"","cvss_accessvector":"N","cvss_accesscomplexity":"M","cvss_authentication":null,"cvss_confidentialityimpact":"P","cvss_integrityimpact":"P","cvss_availabilityimpact":"N","cvss_exploitablity":null,"cvss_remediationlevel":"W","cvss_reportconfidence":"C","cvss_collateraldamagepotential":"ND","cvss_targetdistribution":"H","cvss_securityrequirementscr":"ND","cvss_securityrequirementsir":"ND","cvss_securityrequirementsar":"ND","cvss_basescore":"5.8","cvss_basevector":"AV:N/AC:M/Au:N/C:P/I:P/A:N","cvss_temporalscore":"5","cvss_environmentalscore":"4.92530984505","cvss_environmentalvector":"CDP:ND/TD:H/CR:ND/IR:ND/AR:ND","metric":0.0,"vulnote":null}