i'm solving issue of webform application security issue.
security team is said default path="/" is vulnerable
i'm solving issue of webform application security issue.
security team is said default path="/" is vulnerable
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Mar 8, 2023, 12:09 PM
suppose you have a.aspx, b.aspx and c.aspx pages. In which only a.aspx requires cookies. b and c pages have nothing to do with the cookie. so, if a user make a request to b or c then the cookie should not go to the server from the user's browser.
For default path , it doesn't matter in which page the user is currently, the browser will send the cookie to server with each request.
Are you getting the point?
The browser just mathes the domain and the url to send a request, for example, suppose you are logged in to c# corner and on another tab there is a website opened name it webA, on webA there is button win 10000$, suppose the button is inside any form like
now when you will click on win 1000$, as you are logged in to c# corner and you are in answer section page ,from another tab, then the cookie of c# corner (from answer page (if cookie path is default)) will also be sent to the server and the c#corner would think the request is from c#corner website and not from another website.
Vishal JoshiPosted Mar 8, 2023, 10:56 AM
Hello
We can use some Web.config settings to restrict the domain of our cookies.
We can restrict the path, we’ll need to add some server-side code. How we handle this is dependent mainly on the structure of our application, but the example function below allows us to specify the path from a value in our Web.config when we set a cookie.
Thanks
Naimish MakwanaPosted Mar 8, 2023, 9:35 AM
Hello Tahir,
In ASP.NET, when you set the cookie path to "/", it means that the cookie will be accessible from all pages on the website, including pages in subdirectories. This can be a security issue because it makes it easier for an attacker to steal the cookie and use it to impersonate the user.
To mitigate this vulnerability, you can set the cookie path to a more specific path that corresponds to the portion of the website that requires the cookie. For example, if the
Refere below link:
https://stackoverflow.com/questions/576535/cookie-path-and-its-accessibility-to-subfolder-pages
Thanks
Naimish Makwana