Raised This Month: $51 Target: $400
 12% 

GetUserAdmin security issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-11-2019 , 11:47   GetUserAdmin security issue
Reply With Quote #1

Hi,

I think some plugin produces security hole.

Sometimes random clients become:

Quote:
GetUserAdmin(i) != INVALID_ADMIN_ID
and
Quote:
xxx. (STEAM_xxx | x.x.x.x). Admin name: , Inher.flag: 0, Group flag: 0, GroupCount: 0, Immun.: 0, User flag bits: 0
What kind of code could create such issue?

Code, I used to log above info:
Spoiler


Why GetUserAdmin() returns non-empty AdminId when client has 0 flag bits?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-11-2019 , 16:00   Re: GetUserAdmin security issue
Reply With Quote #2

Are you using a plugin that uses CreateAdmin anywhere? Admins created that way will exist until you call RemoveAdmin whether or not they have any permissions.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-11-2019 , 17:01   Re: GetUserAdmin security issue
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
Are you using a plugin that uses CreateAdmin anywhere? Admins created that way will exist until you call RemoveAdmin whether or not they have any permissions.
Pretty source Sourcebans does this.

'Admin' is a loose term. If you're looking if a user has elevated privileges use CheckCommandAccess(), as it not only can fall back to a flag but it also allows server operators to customize who has access to what. Which is another reason I created my GroupHandlerAPI in favor of plugins creating their own adminIds for users and assigning them flags.
Mitchell is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-11-2019 , 17:09   Re: GetUserAdmin security issue
Reply With Quote #4

Only sourcebans.

Thank you. I'll check it.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-11-2019 , 17:12   Re: GetUserAdmin security issue
Reply With Quote #5

Mitchell, I just need to check whether client is specified in admins_simple.ini file.

I think such check will be enough:
PHP Code:
stock bool IsClientAdmin(int client)
{
    return (
GetUserAdmin(client) != INVALID_ADMIN_ID && GetUserFlagBits(client) != 0);

Isn't it?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-11-2019 , 17:16   Re: GetUserAdmin security issue
Reply With Quote #6

BTW, do you know why sourcebans require CreateAdmin() ?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-11-2019 , 17:28   Re: GetUserAdmin security issue
Reply With Quote #7

Quote:
Originally Posted by Dragokas View Post
BTW, do you know why sourcebans require CreateAdmin() ?
Because it doesnt save into admins.cfg etc, it connects to their database and selects the admin list there. When it comes back it creates admin for users if they are needed. Either which way some one can still end up being admin when they have no permissions.
If you specifically want to know if they are in admin_simple.ini then you'll have to parse them or assign the steamid to a group name "@SimpleAdmin" etc and check if they are in the SimpleAdmin group

Also sourcemod native plugins use CreateAdmin also. It just shouldnt be used they way your using it to get the admin id to check if they're admin.

Last edited by Mitchell; 04-11-2019 at 17:29.
Mitchell is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-11-2019 , 17:30   Re: GetUserAdmin security issue
Reply With Quote #8

Brrrr, too difficult for such simple task.

Thanks for info.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 04-11-2019 at 17:30.
Dragokas is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode