CVE-2017-12904 (published 2017-08-23T14:29Z)

Improper Neutralization of Special Elements used in an OS Command in bookmarking function of Newsbeuter versions 0.7 through 2.9 allows remote attackers to perform user-assisted code execution by crafting an RSS item that includes shell code in its title and/or URL.

Severity: HIGH
CVSS v2 base score: 9.3 (AV:N/AC:M/Au:N/C:C/I:C/A:C)
CVSS v3 base score: 8.8, HIGH (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-943
cwe_name: Improper Neutralization of Special Elements in Data Query Logic
description: The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query.
extended_description: 
            Depending on the capabilities of the query language, an attacker could inject additional logic into the query to:
               
                  Modify the intended selection criteria, thus changing which data entities (e.g., records) are returned, modified, or otherwise manipulated
                  Append additional commands to the query
                  Return more entities than intended
                  Return fewer entities than intended
                  Cause entities to be sorted in an unexpected way
               
            The ability to execute additional commands or change which entities are returned has obvious risks. But when the product logic depends on the order or number of entities, this can also lead to vulnerabilities. For example, if the query expects to return only one entity that specifies an administrative user, but an attacker can change which entities are returned, this could cause the logic to return information for a regular user and incorrectly assume that the user has administrative privileges.
            While this weakness is most commonly associated with SQL injection, there are many other query languages that are also subject to injection attacks, including HTSQL, LDAP, DQL, XQuery, Xpath, and "NoSQL" languages.
         
         

Fix information:
repo_url: https://github.com/akrennmair/newsbeuter
commit_details: repo_url: https://github.com/akrennmair/newsbeuter
author: Alexander Batischev
author_date: 2017-08-13 21:48:35+03:00
msg: Sanitize inputs to bookmark-cmd (#591)

Newsbeuter didn't properly shell-escape the arguments passed to
bookmarking command, which allows a remote attacker to perform remote
code execution by crafting an RSS item whose title and/or URL contain
something interpretable by the shell (most notably subshell
invocations.)

This has been reported by Jeriko One <jeriko.one@gmx.us>, complete with
PoC and a patch.

This vulnerability was assigned CVE-2017-12904.
repository: repo_url: https://github.com/akrennmair/newsbeuter
repo_name: akrennmair/newsbeuter
description: Newsbeuter is an open-source RSS/Atom feed reader for text terminals.
repo_language: C++
owner: akrennmair
file_changes: filename: controller.cpp
change_type: ModificationType.MODIFY
diff: @@ -1344,12 +1344,12 @@ std::string controller::bookmark(
 	std::string bookmark_cmd = cfg.get_configvalue("bookmark-cmd");
 	bool is_interactive = cfg.get_configvalue_as_bool("bookmark-interactive");
 	if (bookmark_cmd.length() > 0) {
-		std::string cmdline = strprintf::fmt("%s '%s' %s %s %s",
+		std::string cmdline = strprintf::fmt("%s '%s' '%s' '%s' '%s'",
 		                                       bookmark_cmd,
 		                                       utils::replace_all(url,"'", "%27"),
-		                                       quote_empty(stfl::quote(title)),
-		                                       quote_empty(stfl::quote(description)),
-		                                       quote_empty(stfl::quote(feed_title)));
+		                                       utils::replace_all(title,"'", "%27"),
+		                                       utils::replace_all(description,"'", "%27"),
+		                                       utils::replace_all(feed_title,"'", "%27"));
 
 		LOG(level::DEBUG, "controller::bookmark: cmd = %s", cmdline);
 

programming_language: C++