MySQL Security – Risks of Granting SUPER Privileges to a User

MySQLSecurity

I had problems in restoring procedures in my db, so what I did was to grant SUPER privileges to my dbuser.

This user is the same user used in my web application, so I would like to know if there is any danger in granting SUPER privileges to a user.

Best Answer

It is always a bad idea to give a user more access than it needs to perform its duties.

This user is the same user used in my web application

If your application is hacked due to a bug in your code or one of the libraries/modules that you are using, the attacker may end up being able to take action as this user - so if this user has privileges that allow the complete destruction of the application database and other databases on the same server then a successful attacker gets these dangerous privileges too.

An application user should have the absolute minimum privileges that it needs to act on behalf of normal tasks required by the application. For larger systems it is not uncommon to have multiple application users for different parts of the system each with restricted rights that block them from interacting with unrelated objects in the database. Other privileges that allow management of the database and server more generally should be give only to separate administration users.

If you are in a situation where an application user needs administrative privileges then it is recommended that you try refactor your design to remove such need (or limit it as much as is possible).

Lookup the Principal of Least Privilege (i.e. https://en.wikipedia.org/wiki/Principle_of_least_privilege) for more information about why this is a good idea generally.