We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果配置mysql实例时使用的账号权限较高,且开放查询功能,会导致普通账号可以查询mysql.user表,从而造成账号密码可能泄露。
增加一个补丁 query.py.20211021.patch
diff --git a/sql/query.py b/sql/query.py index a5926f3..14de028 100644 --- a/sql/query.py +++ b/sql/query.py @@ -53,6 +53,16 @@ def query(request): result['msg'] = '页面提交参数可能为空' return HttpResponse(json.dumps(result), content_type='application/json') + # 禁止非超级用户查看mysql.user表 + if not user.is_superuser: + + if re.match('.*\\s(mysql|`mysql`)(\\s)*\\.(\\s)*(user|`user`)((\\s)*|;).*',sql_content.lower().replace('\n','')) or\ + (db_name=="mysql" and re.match('.*(user|`user`)((\\s)*|;).*',sql_content.lower().replace('\n',''))): + + result['status'] = 1 + result['msg'] = '您无权查看该表' + return HttpResponse(json.dumps(result), content_type='application/json') + try: config = SysConfig() # 查询前的检查,禁用语句检查,语句切分
应用补丁
cd /opt/archery patch -p1 < query.py.20211021.patch
The text was updated successfully, but these errors were encountered:
可以提交pr
Sorry, something went wrong.
禁止普通账号查询mysql.user (hhyo#1202)
c07e05c
e3bc162
Merge pull request #1222 from weideguo/pr20211108
b5d90df
禁止普通账号查询mysql.user (#1202)
No branches or pull requests
目前遇到的问题/使用障碍
如果配置mysql实例时使用的账号权限较高,且开放查询功能,会导致普通账号可以查询mysql.user表,从而造成账号密码可能泄露。
希望如何解决/实现它
增加一个补丁
query.py.20211021.patch
应用补丁
The text was updated successfully, but these errors were encountered: