An SQL injection allows unauthenticated attackers to execute arbitrary SQL queries. This is achieved by injecting malicious code through the `wp sap` cookie parameter, enabling the extraction of sensitive database information such as usernames, passwords, and other confidential data.