Cross-site request forgery (CSRF) is a type of attack that tricks a user into performing unwanted actions on a website they're authenticated to by submitting forged HTTP requests from another site. It works by exploiting a website's trust in a user's browser and authenticated cookies to transmit requests without the user's knowledge or consent. To prevent CSRF, websites should only use POST requests to initiate actions, check HTTP referrers, and include random server-generated tokens in all form submissions.