-
Notifications
You must be signed in to change notification settings - Fork 37
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
Injection vulnerability in ExIRC.Client.msg() / IRC standard nonconformance #97
Comments
This is the same class of issue as SQL injection, in that unknown (theoretically attacker-controlled) content is being directly passed through to an API that expects text that may contain control sequences - after all, The actual behavior here (IIRC) is that of your "Creative" solution - i.e. it results in multiple messages. The problem is that of control sequences like I'm not the primary maintainer of this library any more, that would be @tchoutri, but figured I would chime in with my two cents at least. |
No, that's an actual newline, not a weird escape sequence or anything. (IRC is line-wise, so this sends more than one message!) |
Yes, I'm aware, I'm saying that it is perfectly valid to call |
Er, actually it does not… it would be fine if it did! Specifically, this is what was sent by the bot to the TCP socket:
It would be completely fine if it had sent:
Because in the channel we would see this:
(this is what I called "Creative", but unfortunately is not what happens) |
Just insisting that this made the bot disconnect from IRC, not post an Action Message. |
I'll present this as a little story:
Suppose we are implementing a bot that reads the titles from Web pages and posts them on IRC, a classic.
As a short introduction (only vaguely related to the bug), further suppose that we are using Floki (which is also not standards conformant) to parse the title of say, this webpage:
(this is conformant HTML, even though the formatting isn't pretty!)
Assume the result gets into
title = "I don't want to\nquit programming!"
… and we get to the ExIRC bug:In the IRC channel we see:
Oops.
Obvious solutions:
ExIRC.Client.msg()
aStringWithoutNewlines
type, preventing the error at compile time.My preference goes to the last two, and specifically both of them at once:
ExIRC.Client.msg()
refuse newlines, preventing the application from starting if that's not guarded against, andExIRC.Client.msg_multiline()
method that posts several messages to accomodate for the line feeds.For more ideas, see https://eiv.dev
The text was updated successfully, but these errors were encountered: