-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
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
Filter evil characters in name and message (bug 5912, bug 6301) #357
base: master
Are you sure you want to change the base?
Conversation
It's hapenned |
What do you mean? I know it has been around since some time, and you have some metamod module (like localizebugfix or SafeChatAndMessage) for that, even reHLDS partially fixed, but it should be anyway available by default in AMXX. Better late than never, right? I would prefer more having helpful answers really. |
I'm not sure if I understand correctly. Will the character + be replaced unconditionally every time you show a menu? |
Not the +, but the next character by an unicode character. http://unicode-table.com/blocks/halfwidth-and-fullwidth-forms/ |
And they look pixel identical ingame I would guess? |
Close enough. On HUD/Menus I'm sure it will look flawless (since it's font much better with unicode). A cvar to disable this feature entirely would be nice. |
Why would you want to disable a protection? That's the purpose of this PR, giving feedback, so please elaborate, maybe it makes sense I don't know. |
Because this protection isn't seamless (it replaces user names, and strings in a way that is invisible (but different) to plugins) and you may want to handle this at a plugin level or whatever. Options are always a good idea when you have new, different behavior |
with this feature, do we still need client_printex() stock ? |
@luxxxoor We have no natives to send predefined text with arguments like does the game. You can do that manually via @IgnacioFDM But I think you're saying that plugin should get an unmodified input and filtering should happen only in case message is going to be sent after plugin did their stuff on it. The purpose would be then to keep current engine/mod/amxx behavior but filtering at the very end for displaying. For a fix inside AMXX, this would be actually more welcomed I guess. Is it what you mean? About filtering a plugin, it's probably a bad idea. You can't filter properly and fix an exploit should be anyway in core. |
Filtering happening after sending the message (so plugins get raw input) is a much better way to do it. Imagine you have a plugin where you have (similar to admin say) hook"say" clcmd, and you print text in a special way when the message begins with + (or #) (similarly to how @ is treated for admin say). Now not only you break compatibility with older plugins without support, but you also require plugins to detect some silly longer than 1 byte unicode character instead of simply Besides, the cvar for future regamedll/hlds changes as you said is very important. Furthermore, implementing a cvar is simply less effort and would have taken less time than this discussion 😆 In general, I've been frustrated many times (in other games) for having "protections" (such as anti speed hack, anti DoS or whatever) that end up backfiring, so having an option to toggle is always a good idea unless we are talking of something 100% innocuous such as maybe fixing some buffer overflow or whatever. By the way, is the adminsay.sma (or whatever it's called) exploit fixed, where you could |
I agree to filter About cvar, if the patch doesn't mess with the original input, you have no reason to have it disabled, but because of reHLDS/GameDLL and maybe other tools/contexts, it's okay to add one I guess. About Thanks for your feedback. |
Did you try (admins' client should crash) I'm not home and can't test now, but that's a confirmed exploit on amx <= 1.8.2 |
(I mean without this commit, with this commit I'm sure it won't work) |
When I said beta, I mean the client CS. Right now, I have opted for the beta and it doesn't crash. |
Yes, you're right about client_t, but probability struct is updated again is near zero. Could be fixed through a gamedata file. It's anyway not a good example since it can be done differently. I know about svencoop, but they do what they can to not break compatibility.Though they are trying to get rid of AMXX with their AngelScript, so sooner or later, things might be complicated. Considering the low number of servers under AMXX and because I'm kind of alone, dealing with svencoop specificities is not really a priority. But this should be fine for some time, this is not in their interest. About your last question, functionalities relying on gamedata are optional. Only associated stuff are concerned. (Btw, AMXX is old, you can't expect everything being well organized in a way it makes sense. Cvar stuffs are originally made in core, so hooking cvars have to be there as well. AMXX code source is horrible in many ways). |
@Arkshine Any news ? |
Some feedback after having used something similar to this over a year: I've been using the UTIL_FilterEvilChars reimplemented in pawn with great success (I needed having access to the "raw data" and a bit more fine-grained control than this PR).
That's my personal opinion of course. |
|
Totally forgot about this. I'm kind of lost about this. @WPMGPRoSToTeMa, do you know exactly what it still needs to be filtered in HLDS and what to skip with ReHLDS? |
@Arkshine nothing with ReHLDS and only nicknames with HLDS. |
@WPMGPRoSToTeMa Looks like ReHLDS doesn't do that. I'm not sure if it's a good idea that both don't behave the same. Any thoughts on it? Is it really worth? Actually, what are the compatibility issues, I see tag checking I guess, are there others? About localized strings, if I remember, only the keys in /resources/$mod_english.txt are concerned, right? |
I didn't think about that when I commited in ReHLDS. There is still an open issue rehlds/ReHLDS#198, so I will resolve it in ReHLDS in future. Some people also said that these symbols aren't displayed correctly for them (empty squares).
In We can also filter
The second problem gives me a new idea for another PR: enhanced detection of duplicate names, so Also instead of removing "invisible" symbols we can try to replace them with visible alternatives. (I'm talking about ReHLDS and SNAC invisible symbols removing) |
and what bout client_command cmd's? |
any news? |
This fixes a known exploit around localized string and var arg, like
#Spec_Help_Text
,+forward
or%s
, which can cause bugs with multiple occurrences, at worst crashing a client.While it should not crash on the client (typically an overflow with localized strings), unfortunately, this is happening because AMXX sends a message as it is directly and people are enough cunning to use such string in their name as well.
The concerned messages are:
TextMsg
,SayText
andShowMenu
.This means that any plugin which displays a menu with player's name (like slap menu) or rewrites the chat output (like adminchat with
say_team @
), at best you get an unwanted translated message, at worst it crashes the client who receives the message.Ideally, the name should be filtered in the engine, and anything typed in
say/_team
in the mod, but since AMXX is equally responsible and goldsrc is not a priority for valve, it makes sense we do this filtering.This patch filters the following characters in those specific events:
say
andsay_team
read_args
which is used by the plugin to retrieve the whole input buffer from chat before being passed in natives usingTextMsg
,SayText
such asclient_print/_color
or manually viawrite_string
.+
<key>
[key]
.ShowMenu
&
<value>
ShowMenu
?#
<value>
ShowMenu
,SayText
,TextMsg
%
s
SayText
, ``TextMsg`Some notes ^:
&
. It seems engine already filters it by replacing by spaces, but for safety I keep it%
should be filtered by the mod if you opt for the beta, but for safety I keep it.#
and%
are concerned in messagesI would like some feedbacks.