<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 14, 2014 at 6:27 PM, Chirayu Chiripal <span dir="ltr"><<a href="mailto:chirayu.chiripal@gmail.com" target="_blank">chirayu.chiripal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Oct 14, 2014 at 6:10 PM, Chirayu Chiripal <span dir="ltr"><<a href="mailto:chirayu.chiripal@gmail.com" target="_blank">chirayu.chiripal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi all,<br><div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Oct 14, 2014 at 2:04 PM, Madhura Jayaratne <span dir="ltr"><<a href="mailto:madhura.cj@gmail.com" target="_blank">madhura.cj@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>Following queries are used to assess whether the logged in user has super, create user and grant privileges respectively. See [1]<br clear="all"><div><br></div><div>SELECT 1 FROM mysql.user LIMIT 1<br></div></div></div></blockquote><div><br></div></span><div>This is used to see if user is phpMyAdmin superuser and for phpMyAdmin, the super user is the user having read access to `mysql.user`.<br> <br></div><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div></div><div><div>SELECT 1 FROM INFORMATION_SCHEMA.USER_PRIVILEGES WHERE PRIVILEGE_TYPE = 'CREATE USER' LIMIT 1</div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>SELECT 1 FROM INFORMATION_SCHEMA.USER_PRIVILEGES WHERE IS_GRANTABLE = 'YES' LIMIT 1<br> <br></div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><br></div><div>However, if I create a user with all global privileges except for 'GRANT', 'SUPER', and 'CREATE USER' privileges all the above queries return 1 since the queries does not check for the grantee column. Rows corresponding to root user make all these queries return 1.</div></div></div></blockquote></span><div><br>Similarly, USER_PRIVILEGES tells about the global privileges of current
logged in user. Even if user is not having Global GRANT privilege he can
still grant privileges to user (those privileges which he has), So, he is kind of a GRANT user for phpmyadmin.<br><br></div><div>I don't know why, but I created a similar user that you have created but using that new user can still create more users using that new user.<br></div></div></div></div></div></blockquote><div><br></div></span><div>I just saw my previous research (for some RFE in which this task was done). Actually, the user needs either of global CREATE_USER or INSERT privileges on mysql table (So he can still create user w/o having global create user). </div></div></div></div></blockquote><div><br></div><div>Thanks. This seems to be true. If I remove INSERT global privilege from the user he no longer can create a new user (He was already lacking CREATE_USER privileges)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>So each of the queries looks fine to me.<br></div></div></div></div></blockquote><div><br></div><div>I'm not too sure. The issue is these queries lacking a WHERE GRANTEE = <current user> clause.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Also, If I am not wrong, GRANTEE is the user from which he got those particular privileges and is not the current user itself.<br></div><span class=""><div> </div></span></div></div></div></blockquote><div>If this is true a freshly created use would not have an entry in the USER_PRIVILEGES table (since the new user has not granted anything), but this is not the case.</div></div><br clear="all"><div><br></div>-- <br>Thanks and Regards,<div><br></div><div>Madhura Jayaratne<br><div><br></div></div>
</div></div>