Lucene search
+L

TWiki Detection

🗓️ 06 Oct 2005 00:00:00Reported by TenableType 
nessus
 nessus
🔗 www.tenable.com👁 29 Views

The remote web server hosts a Wiki system written in Perl

Refs
Code
SourceLink
twikiwww.twiki.org/
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(19941);
  script_version("1.20");
  script_set_attribute(attribute:"plugin_modification_date", value:"2023/05/24");

  script_name(english:"TWiki Detection");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server hosts a Wiki system written in Perl.");
  script_set_attribute(attribute:"description", value:
"The remote host is running TWiki, an open source wiki system written
in Perl.");
  script_set_attribute(attribute:"see_also", value:"http://twiki.org");
  script_set_attribute(attribute:"solution", value:
"n/a");
  script_set_attribute(attribute:"risk_factor", value:"None");

  script_set_attribute(attribute:"plugin_publication_date", value:"2005/10/06");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"asset_inventory", value:"True");
  script_set_attribute(attribute:"asset_inventory_category", value:"software_enumeration");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:twiki:twiki");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

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

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

  script_dependencies("http_version.nasl");
  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("install_func.inc");

port = get_http_port(default:80);
app = "TWiki";

# Search through various directories.
if (thorough_tests) dirs = list_uniq(make_list("/twiki/bin", "/wiki/bin", "/cgi-bin/twiki", cgi_dirs()));
else dirs = make_list(cgi_dirs());

num_installs = 0;
pre_dir = NULL;

foreach dir (alpha_sort(dirs))
{
  # Check to make sure we don't flag an install under a previous directory
  # name to prevent double reporting a single install
  rpeat = FALSE;

  pre_dir1 = ereg_replace(pattern:"(/[^/]+/).*", string:pre_dir, replace:"\1");
  new_dir = ereg_replace(pattern:"(/[^/]+/).*", string:dir, replace:"\1");

  if (!isnull(pre_dir1))
    rpeat = ereg(pattern:"^"+pre_dir1+"/", string:new_dir+"/");
  if (rpeat) continue;

  alt_found = FALSE;
  # Try to get the TWiki Web home page.
  res = http_send_recv3(
    method       : "GET",
    item         : dir + "/view/TWiki/WebHome",
    port         : port,
    exit_on_fail : TRUE
  );

  if (res[0] =~ "(404|301|302)")
  {
    res = http_send_recv3(
      method       : "GET",
      item         : dir + "/",
      port         : port,
      exit_on_fail : TRUE
    );
  
    if ('alt="Powered by TWiki"' >< res[2])
    {
      alt_found = TRUE;
      # Get and follow link the WebHome
      match = eregmatch(
        pattern: '\\|\\s+<a href="(.*/TWiki/WebHome)">',
        string  : res[2]
      );
      if (!empty_or_null(match))
      {
        res = http_send_recv3(
          method       : "GET",
          port         : port,
          item         : match[1],
          exit_on_fail : TRUE
        );
      }
    }
  }

  # If it looks like TWiki...
  if (
    'alt="This site is powered by the TWiki' >< res[2] ||
    '<div class="twikiMain"><div class="twikiToolBar"><div>' >< res[2] ||
    '/view/TWiki/WebHome?skin=print">' >< res[2] ||
    'class="twikiFirstCol">' >< res[2] ||
    alt_found
  )
  {
    # Ignore FP with 'oops' error page
    if ('patternOopsPage"' >< res[2]) continue;

    # Try to pull out the version number, build date, and build number.
    ver = UNKNOWN_VER;
    build_date = UNKNOWN_VER;
    build_number = UNKNOWN_VER;

    pat = "This site is running TWiki version <strong>(.+)</strong>";
    matches = egrep(pattern:pat, string:res[2]);
    if (matches)
    {
      foreach match (split(matches, keep:FALSE))
      {
        ver_pat = "version <strong>TWiki-([0-9\.\-A-Za-z]+)";
        item = eregmatch(pattern:ver_pat, string:match);
        if (!isnull(item)) ver = item[1];

        date_pat = "([0123][0-9] [A-Za-z]{3} [12][0-9]+)";
        item = eregmatch(pattern:date_pat, string:match);
        if (!isnull(item)) build_date = item[1];

        build_pat = "build ([0-9]+)</strong>";
        item = eregmatch(pattern:build_pat, string:match);
        if (!empty_or_null(item))
        {
          build_number = item[1];
          break;
        }
      }
    }

    # Versions 6.x.
    matches2 = egrep(pattern:"<li> Installed: TWiki-(.+)", string:res[2]);
    if (matches2)
    {
      foreach match (split(matches2, keep:FALSE))
      {
        ver_pat = "Installed: TWiki-([0-9\.\-A-Za-z]+)";
        item = eregmatch(pattern:ver_pat, string:match);
        if (!empty_or_null(item)) ver = item[1];

        date_pat = "([0123][0-9] [A-Za-z]{3} [12][0-9]+)";
        item = eregmatch(pattern:date_pat, string:match);
        if (!empty_or_null(item)) build_date = item[1];

        build_pat = "build ([0-9]+),";
        item = eregmatch(pattern:build_pat, string:match);
        if (!empty_or_null(item))
        {
          build_number = item[1];
          break;
        }
      }
    }

    # Versions prior to 4.0.5 used the date as the displayed version
    if (ver == UNKNOWN_VER) ver = build_date;

    if (!alt_found)
    {
      # Add /view to directory to ensure report URL reaches a TWiki page
      # in cases where we didn't follow a direct link
      dir = dir + "/view";
    }

    installs = register_install(
      vendor   : "TWiki",
      product  : "TWiki",
      app_name : app,
      path     : dir,
      version  : ver,
      port     : port,
      webapp   : TRUE,
      cpe      : "cpe:/a:twiki:twiki",
      extra_no_report : make_array(
        "Build Date", build_date,
        "Build Number", build_number)
    );
    num_installs++;
    pre_dir = dir;
    # Scan for multiple installations only if the "Perform thorough tests" setting is checked.
    if (!thorough_tests) break;
  }
}
if (num_installs == 0) audit(AUDIT_WEB_APP_NOT_INST, app, port);

report_installs(port:port);

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

24 May 2023 00:00Current
5.5Medium risk
Vulners AI Score5.5
29