What is the difference between XSS and CSRF from their execution perspective?

What is the difference between XSS and CSRF from their execution perspective?

https://www.quora.com/What-is-the-difference-between-XSS-and-CSRF-from-their-execution-perspective/answer/Deepthi-210

Fundamental difference is that CSRF (Cross-site Request forgery) happens in authenticated sessions when the server trusts the user/browser,

while XSS (Cross-Site scripting) doesn't need an authenticated session and can be exploited when the vulnerable website doesn't do the basics of validating or escaping input.

 

In case of XSS, when the server doesn't validate or escapes input as a primary control, an attacker can send inputs via request parameters or any kind of client side input fields (which can be cookies, form fields or url params).These can be written back to screen , persisted in database or executed remotely.

For CSRF, consider an example when you are logged in into your banking site and at the same time logged into Facebook in another tab in same browser.

An attacker can place a malicious link embedded in another link or zero byte image which can be like your banksite.com/transfer.do?fromaccnt=youraccnt&toaccnt=attackersAccount&amt=2500.

Now, if you accidentally click on this link , in the background transfer can happen though you clicked from the Facebook tab.

 

This is because your session is still active in browser and browser has your session id.

This is the reason the most popular CSRF protection is having another server supplied unique token generated and appended in the request.

This unique token is not something which is known to browser like session id.

This additional validation at server (i.e whether the transfer request also contains the correct CSRF token) will make sure that the attacker manipulated link (I.e the CSRF attack) in above example will never work.

 

https://www.quora.com/What-is-the-difference-between-XSS-and-CSRF-from-their-execution-perspective/answer/Yash-Pandya-4

csrf is all about checking auth_tockens used in from , in csrf attck you can create spoof html form and force other victim to do things according to your need while xss is all about javascript execution . you can read more about both on owasp.org

 

https://www.quora.com/What-is-the-difference-between-XSS-and-CSRF-from-their-execution-perspective/answer/Gaurav-Sharma-2819

The fundamental difference between CSRF and XSS is that

cross-site scripting (XSS), is designed to exploit the trust the user has for a particular site

whilst

CSRF aims to exploit the trust that a website has in the visitor’s browser.

 

Difference between XSS and CSRF attacks

How does a CSRF attack work?

<img src="https://facebook.com/logout">

This will cause your browser to load the image-URL of the img tag, which comes down to a GET request to https://facebook.com/logout. Your browser will automatically send your session together with the GET-request to Facebook.

That means that the attacker was able log you out. He made a valid request with your user context without you even knowing.

 

转载于:https://www.cnblogs.com/chucklu/p/11528284.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值