SQL Wildcard GRANT Privilege

Detects SQL GRANT statements with wildcard privileges that over-privilege database users.

zakirkun b10f64f 2 files · 2.4 KB Updated

File contents

SQL Wildcard GRANT Privilege

Overview

GRANT ALL PRIVILEGES or GRANT * in SQL scripts gives a database user excessive permissions. Application database users should only have the minimum permissions required (SELECT, INSERT, UPDATE, DELETE on specific tables).

Remediation

Follow the principle of least privilege for database users. Grant only the specific operations needed on specific tables.

Vulnerable:

GRANT ALL PRIVILEGES ON *.* TO 'app_user'@'%';

Safe:

GRANT SELECT, INSERT, UPDATE, DELETE ON myapp.users TO 'app_user'@'%';

zakirkun/ice-tea/tree/main/skills/database/sql-wildcard-grant commit b10f64f467

Frequently asked questions

npx skillmds@latest add zakirkun/sql-wildcard-grant-privilege