Vulnerabilities > CVE-2013-1666 - Code Injection vulnerability in Foswiki

047910
CVSS 6.8 - MEDIUM
Attack vector
NETWORK
Attack complexity
MEDIUM
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
foswiki
CWE-94
nessus

Summary

Foswiki before 1.1.8 contains a code injection vulnerability in the MAKETEXT macro.

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Leverage Executable Code in Non-Executable Files
    An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
  • Manipulating User-Controlled Variables
    This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An attacker can override environment variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the attacker can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.

Nessus

NASL familyCGI abuses
NASL idFOSWIKI_1_1_8.NASL
descriptionAccording to its version number, the instance of Foswiki installed on the remote host is affected by a code injection vulnerability in the
last seen2020-06-01
modified2020-06-02
plugin id65059
published2013-03-06
reporterThis script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/65059
titleFoswiki < 1.1.8 MAKETEXT Macro Arbitrary Code Injection
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(65059);
  script_version("1.5");
  script_cvs_date("Date: 2019/12/04");

  script_cve_id("CVE-2013-1666");
  script_bugtraq_id(58026);

  script_name(english:"Foswiki < 1.1.8 MAKETEXT Macro Arbitrary Code Injection");
  script_summary(english:"Checks version of Foswiki.");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a CGI application that is affected by a
code injection vulnerability.");
  script_set_attribute(attribute:"description", value:
"According to its version number, the instance of Foswiki installed on
the remote host is affected by a code injection vulnerability in the
'%MAKETEXT{}%' macro.  An incomplete fix to CVE-2012-6329 left this
attack vector available in which an attacker can invoke arbitrary Perl
modules by escaping brackets within 'MAKETEXT =~~[Some::Module,~~]='. 

Note that Foswiki installations in which localization is not enabled or
'Locale::Maketext' has been upgraded to version 1.23, are not affected. 

Note also that Nessus has not tested for this issue, but instead, has
relied only on the application's self-reported version number.");
  script_set_attribute(attribute:"see_also", value:"http://foswiki.org/Support/SecurityAlert-CVE-2013-1666");
  script_set_attribute(attribute:"solution", value:
"Either upgrade to version 1.1.8 or later or apply the hotfix in the
referenced URL.  Additionally, Locale::Maketext should be upgraded to
version 1.23.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2013-1666");

  script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"false");

  script_set_attribute(attribute:"vuln_publication_date", value:"2013/02/19");
  script_set_attribute(attribute:"patch_publication_date", value:"2013/02/18");
  script_set_attribute(attribute:"plugin_publication_date", value:"2013/03/06");

  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:foswiki:foswiki");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"CGI abuses");

  script_copyright(english:"This script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("foswiki_detect.nasl");
  script_require_keys("Settings/ParanoidReport", "www/foswiki");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_ports("Services/www", 80);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("webapp_func.inc");

port = get_http_port(default:80);

install = get_install_from_kb(
  appname      : "foswiki",
  port         : port,
  exit_on_fail : TRUE
);
dir = install["dir"];
version = install["ver"];
install_url = build_url(port:port, qs:dir+"/view");

if (version == UNKNOWN_VER) audit(AUDIT_UNKNOWN_WEB_APP_VER, "Foswiki", install_url);
if (report_paranoia < 2) audit(AUDIT_PARANOID);

ver = split(version, sep:".", keep:FALSE);
for (i=0; i<max_index(ver); i++)
  ver[i] = int(ver[i]);

# Versions 1.0.0 - 1.1.7 are affected
if (
  (ver[0] == 1 && ver[1] < 1) ||
  (ver[0] == 1 && ver[1] == 1 && ver[2] < 8)
)
{
  if (report_verbosity > 0)
  {
    report =
      '\n  URL               : ' + install_url +
      '\n  Installed version : ' + version +
      '\n  Fixed versions    : 1.1.8' +
      '\n';
    security_warning(port:port, extra:report);
  }
  else security_warning(port);
}
else audit(AUDIT_WEB_APP_NOT_AFFECTED, "Foswiki", install_url, version);