AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   can players exploit sourcemod with their name? (https://forums.alliedmods.net/showthread.php?t=333164)

sukodaime 06-23-2021 06:02

can players exploit sourcemod with their name?
 
servercommand("sm_command %s",GetClientName(client))

if they make their name something like ;quit will it work like sm_command ; then quit the console?
is it somehow possible for them to make their name like something like i mentioned above,if its possible which names are possible threat,(i am not sure but i saw something like ;/quit/ i cant exactly remember)

how can i prevent them from doing that

Psyk0tik 06-23-2021 07:04

Re: can players exploit sourcemod with their name?
 
Yes, that's why you need to target them via User ID or Serial. Never target clients via their name in plugins.
PHP Code:

ServerCommand("sm_command #%i"GetClientUserId(client)); 


sukodaime 06-23-2021 20:08

Re: can players exploit sourcemod with their name?
 
Quote:

Originally Posted by Crasher_3637 (Post 2750833)
Yes, that's why you need to target them via User ID or Serial. Never target clients via their name in plugins.
PHP Code:

ServerCommand("sm_command #%i"GetClientUserId(client)); 


can they exploit it with such an easy name ";quit" or they have to do more complex names?

and how can i make a plugin that says "{playernamer} Welcome !"
if we cant directly use their name

and does using printtochat bypasses that name expoit?

Blinx 06-24-2021 10:03

Re: can players exploit sourcemod with their name?
 
I'm not very knowledgeable about code injection but I think sm_command is your only worry since it's executing a command without any filtering as far as I know, but stuff like PrintToChat and basically every other function doesn't work like that.

As for your specific worry though, %N is a formatting thing that puts someones name into the string provided a client index, i.e.,

PrintToChat(client, "%N Welcome to the server!", client);

Hopefully someone with more indepth knowledge of sourcepawn can verify these things.

MAGNAT2645 06-24-2021 11:56

Re: can players exploit sourcemod with their name?
 
It is safe to use SM's Print* functions. I know only two cases where you shouldn't use player name:
1) FakeClientCommand(Ex), ServerCommand() and ClientCommand() - use UserId instead (as said in #2).

2) SQL Queries - use Database.Format or Database.Escape to escape some symbols in player name.


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

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