zhyynn 发表于 2023-8-19 09:52:00

有delete+alter权限可删除用户

本帖最后由 zhyynn 于 2023-8-19 11:14 编辑

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZcAAADdCAYAAAB30j+zAAAdKklEQVR4Ae2cXZbjtg6Ee/97zFqSg4fKVGMAirIoS5a/Bx2AhR9SYImg5+b2z7///PMvDzWAA3AADsCBlRz4WZmMXJATDsABOAAHggM0F3658csVDsABOLCcAzQXSLWcVNxcubnCATjw6Oby8/NTHpwdzgfBBwEH4AAcWMOBRzaXaB56OqKc1WC25u3WA76G0NSROsKBe3Dgkc1F5NpqIFt25dkrz8q7dx1X+1OHe3zkV/OA+b+TB1/dXIL0ZxyAZ+T8xA+UOnznofKJXGXN67m6vLnEgdI9Osxl14ZqHLLCZJdN0nGPdbv0kaxiR/5h09wuFaN8lc19KrswnyPryjGSyuPS8wRejZUzx2V8NlZ5FC8p3KVskmGTjlz/8VNTanomB5Y3l1isHwqV7phezjHXK3s1x0yMclWyiq/88tzy8fjQfZxjss3t2eZj1zVvJbNfHms+xztdvj5P+Lp/5dNhHZ7z+XzoHIJw4PM4cElzyQdMPljyOBOrss9iOVdeS2XPWDWX+1R2x1xXnGOV7phiOpl98zjiKqzKF37ZN4+7fJVf51vNDfZ5Bwp7xp6JA7dsLrE4HWqSWrBsPt6DzcRln2qsdUm6T2A+Dt0x1+XnmPSQrst3RipW8Tmmw+Wn+Bhn3zyufDos5/d5ZENyQMGBz+fAZc0lyLPnYPEDzXWRcBaTv+b38RHd53ddOR1zfWSXn6R8t+SM/8gn27bGsZ7s02Hd2qv4zhf88w8e9vD5e3jL5lIdNBnzceg+FnErbMYmn05WeR1zXTkcc72yB+Y+rst/S0aMP9l/lNNtyuHxbhe+hbnd9VG8bMjnH0Ts8fP2eHlziYNDTxCm02WrSKUYlyO/nMvjpHt8YD7eqyunS+V4BavW45jrmmckK39hIfNT5ZJP2Co9MMXJ7li2aez5RnHy8zj05x1A7Olz93R5c9lDluow2hPvvitzed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q/UrCXjl3KvrSL5rP9KoP3z6swfU4k8t7vxtvqW5vLsAQb4rCXjl3O+uNfN9xofOPrFP7+bAI5vLu4vIfHy4cAAOwIHfHKC5pD//AkF+E4R6UA84AAde4QDNheby1/9Y+gqRiOEAggNwwDlAc6G50FzgAByAA8s5QHOBVMtJ5bcXdG6zcOA7OUBzobnQXOAAHIADyzlAc4FUy0nFTfU7b6rsO/vuHKC50FxoLnAADsCB5RyguUCq5aTy2ws6t1k48J0coLnQXGgucAAOwIHlHKC5QKrlpOKm+p03VfadfXcO0FxoLjQXOAAH4MByDvwHBgRySKv4jicAAAAASUVORK5CYII=

如上所示,用户user1的权限为" DELETE, ALTER ON *.*",便可以执行删除用户的操作,我在5.7和8.0的最新版中都能复现。8.0版本如果将被删除的用户有SYSTEM_USER权限则不能被删掉,没有该权限也可以被用户user1删掉。


-------
文档中找到了原因

To use DROP USER, you must have the global CREATE USER privilege, or the DELETE privilege for the mysql system database.


yejr 发表于 2023-8-19 12:37:54

很好的分享。
看起来还是挺吓人的,确实不应该给一个普通用户授予这么高级别的权限。
页: [1]
查看完整版本: 有delete+alter权限可删除用户