What is CORS Vulnerability?

 

 image1

is a browser security mechanism that controls which websites (origins) are allowed to access resources (APIs, data) from another domain. A CORS vulnerability occurs when a web application misconfigures CORS headers, allowing unauthorized or malicious websites to access sensitive data or perform actions on behalf of a user.

• Here, in CORS “Origin” refers to combination of schema such as http and https. Refer below example image,

• It contains three-part scheme, host name, port and when it combines form the “origin” of a web application or page.

How CORS works?

In modern web application we have to share resources from another origin and its cross-origin resource like third party files or css files, etc for easy backend communication and to make it flexible easy web design.

How CORS Occurs?

CORS enforce by browser that allows one origin send request to another origin on bases of certain condition and it only allows if there is CORS headers. CORS headers define that which origin allows to access which resource and this header placed in server resource. And when we find like “access-control-allow-origin= ” where star () can be problem because it means by any origin can access resource. Access-control-allow-methods this means by which methods are allowed like GET, POST, DELETE, etc. Access-control-allow-credentials this defines if credentials should be passed the request or not like session cookies or tokens.

 

Comments

Popular posts from this blog