AMM Vulnerabilities and Exploits: How DeFi Attacks Work and How to Defend