What is CSRF and how does it differ from other web-based attacks?

CSRF, or Cross-Site Request Forgery, is a type of malicious exploit where unauthorized commands are transmitted from a user that the web application trusts. Unlike other attacks such as XSS (Cross-Site Scripting), CSRF exploits the trust that a site has in a user’s browser, not the trust a user has in a site. In an XSS attack, the attacker injects malicious scripts into trusted websites to execute on the victim’s browser. However, in CSRF, the attacker tricks the victim into submitting a malicious request leveraging the identity and privileges of the victim to perform an undesired function.