97
votes
Accepted
How do hackers trick frontend validation?
I think you are very confused about what both CORS and SOP do... neither is relevant to these attacks at all.
There are lots of ways to bypass client-side validation. HTTP is just a stream of bytes, ...
23
votes
How do hackers trick frontend validation?
Maybe a very short answer will help as well.
I never thought about it much, I just thought this meant someone could
bypass the validations by making a request on something like Postman.
But then I ...
19
votes
Accepted
HTTP access control (CORS) purpose
For your own good.
If you disable CORS the following can happen:
I send you link to a page called hackfacebook.com for example. When you visit my page, I then request the facebook.com page using an ...
16
votes
What are the security risk of enabling cors on localhost?
The answer really depends on what API you created and how it works.
This site gives a very good explanation on the goods and bads of CORS. In short, the author creates a fictional API that is used to ...
16
votes
Accepted
Can we use CORS policy to restrict API calls from native mobile app?
CORS doesn't prevent anything, and it doesn't protect the server. It simply tells a conforming client (a browser) what is permitted for the protection of the browser's user; CORS is a way to carefully ...
15
votes
Accepted
Vary: origin response header and CORS exploitation
It's important to include the Vary: Origin header to prevent caching. The header indicates that the response is in some way dependent on the origin and should therefore not be served from cache for ...
12
votes
How does CORS prevent XSS?
CORS and XSS are related, but not directly. The best way to explain it is by example: we shall consider 3 servers (your_bank.com, api.your_bank.com, badguy.com*) and 1 client (your browser).
You are ...
12
votes
Accepted
How does setting Origin to null in a redirected CORS request protect against a confused deputy attack?
That paragraph is tersely written, and the use of "redirects to another resource at a new origin" in the first sentence isn't quite right.
Here's a simple contrived example. Let's say you are ...
11
votes
Accepted
What attacks are mitigated by requiring CORS for subresource integrity verification?
The attack
I think the attack they are trying to protect against is the following.
Imagine santaclause.com serves an image at santaclause.com/naughty_or_nice.png to logged in users. The image is a ...
11
votes
Accepted
How did the Facebook Originull vulnerablity of Access-Control-Allow-Origin: null allow cross-origin access?
I'm Ysrael and I'm the researcher that found this vulnerability.
Let's divide your question into 2 parts:
A. How did the Origin of the browser become null?
B. How the null Origin affect Facebook ...
11
votes
Accepted
CORS error but only from AJAX and not from HTML form
This is the expected behavior.
Before CORS it was already possible to make cross-origin requests using HTML forms, cross-origin inclusion of images ... . But it was not possible to do cross-origin XHR ...
11
votes
How do hackers trick frontend validation?
Postman and same origin policy aren't obstacles. To understand this, I need to explain why, as a developer, you virtually never trust the client/front end.
Front and back end trust
If someone controls ...
10
votes
Accepted
How do CORS proxy websites work?
The CORS policy is enforced by the browser, not by the server. The server just sets a couple of HTTP headers telling the browser how it wants it to behave. There is nothing that forces a proxyserver ...
10
votes
Concrete example of how can Access-Control-Allow-Origin:* cause security risks?
[S]uppose website B set the header Access-Control-Allow-Credentials to false, and Access-Control-Allow-Origin: *, can this cause any concrete security risk to the user who is browsing website A (...
10
votes
Accepted
What are the reasons for CORS failure errors to not be available to JS?
The reason is that exposing error details in JavaScript can leak private information to a cross-site scripting attacker. For example, an attacker could scan private networks of the victim by ...
9
votes
Accepted
Why is a "tainted canvas" a risk?
What exactly would that image request URL look like?
It need not be anything complicated or abnormal. There are two main ways this could work (were it not for the restrictions in the browser):
In ...
9
votes
How do hackers trick frontend validation?
Your backend is accessible via the network. That means I don't need to use your frontend. I can find out what endpoints it uses, and and what format the request looks like, and use my own tools to ...
8
votes
Why CORS preflight is not available for POST requests when Content-Type is application/x-www-form-urlencoded
So my understanding of why this is allowed is so that the implementation of CORS wouldn't break existing and well understood functionality which was already allowed by browsers. This also means that ...
8
votes
Accepted
Why are web font resource requests not no-cors?
This mechanism exists mainly as a way for font creators to control which websites can access their possibly copyrighted and licensed products.
As MDN puts it:
... Web Fonts (for cross-domain ...
8
votes
Security Headers: Access-Control-Allow-Origin vs. Cross-Origin-Resource-Policy (CORP)
CORS (Cross-Origin Resource Sharing) in general, and the Access-Control-Allow-... headers in particular, are a way to relax same-origin policy. They are used when you need to allow cross-origin ...
7
votes
Is CORS ever needed during any aspect of OAuth / OpenIDConnect Authentication?
I'm not sure about OpenID, but for OAuth there is no CORS involved for the actual authentication part, though it may be required on the resource server depending on the type of client that is ...
7
votes
Ways to bypass browsers CORS Policy
You can use the following content types without CORS access:
application/x-www-form-urlencoded
multipart/form-data
text/plain
You can try a couple of things:
Try sending valid JSON with another ...
6
votes
vuln Cross-origin resource sharing: arbitrary origin trusted
https://xrmtfgxgjkzw.com is just an example generated by Burp. What it is in fact saying is that any website on the internet that the user is visiting can grab content from your site (possibly private ...
6
votes
How does CORS prevent XSS?
CORS does not protect anything, SOP (Same Origin Policy) protects something instead. SOP protects the target domain and the browser user.
In fact, CORS weaken existing restrictions of SOP to help ...
6
votes
If a CORS request doesn't need authentication, why can't I send it without the cookies?
History
The original XMLHttpRequest implementations did not have the concept of "allow credentials" - all requests had credentials attached. Of course, this would be extremely dangerous to allow ...
6
votes
How does setting Origin to null in a redirected CORS request protect against a confused deputy attack?
Look at the Origin header in terms of CSRF defense.
Let's say a.com hosts...
a service that uses the Origin header to block CSRF attacks,
and a web page that makes CORS requests to b.com.
If the ...
6
votes
Is CORS and CSRF-tokens only for POST and GET requests?
Based on what you ask I think you are confusing concepts a bit:
CSRF is a method to execute an authenticated action cross-site, i.e. triggered by an attacker but executed with the authentication of ...
6
votes
is every site without a CSRF token vulnerable to CSRF attack?
The simple answer is “no”. Cross-Site Request Forgery (CSRF) tokens are a generalized defense against CSRF, but other conditions must be at play to be vulnerable. For example, the attacker needs to be ...
6
votes
Accepted
Is xhr.withCredentials making POST endpoints vulnerable to CSRF?
You don't need an AJAX request, the standard approach to exploit this issue would be:
<form id="myform" method="post" action="http://mysite.vulnerablesite.com/mysite/deleteUser" >
<input ...
6
votes
Accepted
Exploitability of allowed wildcard (*) CORS Origins with Bearer Token Authorization
ACAO: * will prevent the browser from automatically sending any form of credentials, but that's only relevant for the kinds that the browser can actually send automatically (cookies and HTTP BASIC, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
cors × 179same-origin-policy × 43
csrf × 41
web-application × 27
http × 27
cookies × 21
web-browser × 17
javascript × 15
api × 15
crossdomain × 13
authentication × 9
header × 9
xss × 7
ajax × 7
oauth2 × 6
web × 5
same-site-cookies × 5
proxy × 4
access-control × 4
oauth × 4
authorization × 4
rest × 4
jwt × 4
web-service × 4
html × 4