CVE-2015-10096: Improper Neutralization of Special Elements used in a Command ('Command Injection') (CWE-77)
value: A vulnerability, which was classified as critical, was found in Zarthus IRC Twitter Announcer Bot up to 1.1.0. This affects the function get_tweets of the file lib/twitterbot/plugins/twitter_announcer.rb. The manipulation of the argument tweet leads to command injection. It is possible to initiate the attack remotely. The complexity of an attack is rather high. The exploitability is told to be difficult. Upgrading to version 1.1.1 is able to address this issue. The patch is named 6b1941b7fc2c70e1f40981b43c84a2c20cc12bd3. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-223383.
CWE description: The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
CVSS v3 base score: 8.1
Published: 2023-03-20T05:15Z
Repository: https://github.com/Zarthus/irc-twitter-bot
Language: Ruby
Files changed: lib/twitterbot/plugins/twitter_announcer.rb, lib/twitterbot/version.rb
Commit date: 2015-08-13 02:29:13 +0200
Commit message: Prevent edge-case exploitation that allows execution of arbitrary fantasy commands.

This commit replaces \r\n with '.  ' in tweets.

An edge-case issue where you may be able to exploit the bot having op.
Should you be the one being tracked, you could insert a newline in your tweet, and follow it up for "!ban <someone>" to execute a fantasy command.

This exploit requires a lot of requirements to be met. Mainly the fact that the bot has permissions in the channel, and that the followed person is associated and aware of the possibility.

Diff: diff --git a/lib/twitterbot/plugins/twitter_announcer.rb b/lib/twitterbot/plugins/twitter_announcer.rb
index a5c0550..ac373d4 100644
--- a/lib/twitterbot/plugins/twitter_announcer.rb
+++ b/lib/twitterbot/plugins/twitter_announcer.rb
@@ -150,12 +150,13 @@ module TwitterBot
         tweets = []
 
         begin
           @twitter.user_timeline(account, count: amount).each do |tweet|
             name = tweet.user.screen_name
+            twtext = tweet.text.gsub("\r?\n", '.  ')
 
-            tweets << { account: name, tweet: tweet.text, time: tweet.created_at, uri: tweet.uri.to_s, id: tweet.id }
+            tweets << { account: name, tweet: twtext, time: tweet.created_at, uri: tweet.uri.to_s, id: tweet.id }
           end
         rescue StandardError => e
           warn "Unable to retrieve Tweet information for #{account}: #{e}"
           tweets = nil
         end
diff --git a/lib/twitterbot/version.rb b/lib/twitterbot/version.rb
index 70063f1..a16746f 100644
--- a/lib/twitterbot/version.rb
+++ b/lib/twitterbot/version.rb
@@ -1,8 +1,8 @@
 module TwitterBot
   VERSION_MAJOR = 1
   VERSION_MINOR = 1
-  VERSION_BUILD = 0
+  VERSION_BUILD = 1
   VERSION_APPEND = ''
 
   VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_BUILD}#{VERSION_APPEND}".freeze
 end

Vulnerable code:             tweets << { account: name, tweet: tweet.text, time: tweet.created_at, uri: tweet.uri.to_s, id: tweet.id }
  VERSION_BUILD = 0
Fixed code:             twtext = tweet.text.gsub("\r?\n", '.  ')
            tweets << { account: name, tweet: twtext, time: tweet.created_at, uri: tweet.uri.to_s, id: tweet.id }
  VERSION_BUILD = 1