Lucene search
+L

OpenShift Vulnerability Detection Data Collection

🗓️ 24 Nov 2026 00:00:00Reported by TenableType 
nessus
 nessus
🔗 www.tenable.com👁 10 Views

OpenShift Vulnerability Detection Data Collection.

Code
#TRUSTED 9c936cc051aa26b6dafbf38b5bf1f7366319fd2b8f5940fa576def792b5aad8942293067dce6bb2e0b921269a4c48d3e7e3bcfc2aec70d78fc3ca7d3b2aa74708749895475c1fa35caa73bf2fe327d081cb95c396778a062ca0f968cd2869a2db04fa162c0c5f902107a768835a32d357a423c43bde4b6126323348d02062da53296a76e42949ed3419fe7f3e5fdac2b9b989ae07ac4cc106c25fd38c9b58677431e4005222781b44a45347d2481eb81cb0589db1dfaa20ee5913bd5b0c885a761961d49f11344c346c49bb24f2c621e440a86832326eaea266f7a42c59f48971546425341579470600f52848dc6ddbf1949df9bcec2dcae8a3dd016c4bbe391f9f5710bfb61f4f4ad25ad9c254f49640b5871d9912f2dc57189dcb14ade6fe42580d7b359cfe3e22ff418c70fbbab9bffae6ab81411e06f5eea07867d3f849d382c26110d40ca08730d3f1a82388579a56f3184ea4e964c424e5874a06537015831ba2a8b755788ef83eab1cc2b9e321d4e034be32a0a827d1790088a1c5df6314fe0ada29d5cf2ee30c6c2c5283b3c5ddf1330120b87cc8723aa668bc83c70a1db98b22da68ff0c7d12e44510814c9824300b652cf1f5c5b3ee0da3f28f02f4a0861ff13cfa5a351f3f501f8d43e061203ec743ade0313a75e6f5727a130084e78b1a382c565611083af324fbe7f562761a16af6946526d013bfcf33657a07
#TRUST-RSA-SHA256 05195a120e734ae4170128c93bf8e5b1489929b8f8f710d550e0904e7ef57f455c0a509f5de4af4797dd3cc72968da1603bf0ce4203efcaa1076f380409da76385d22f15c2c2fe971e5e6c41ff39d881bc7415f70f5423b76123ad72346ac13da967d5de1ce239c52b354406101f3c070ae0d6c8b9090ba4891545b4669a84c834a6f2a2f1553e70c0afe38eff90080e188ad6c6eea83952f4db96656138711d17cb48955a09bd9d08cc66b060c2f57d16d7c7a0995b8674ae239bff58d0c0eac1b93832921c46ade9488e644eb43201a9d9883c8b8875c7806f4a84cda05f623b9829f4f5c22bb42ec26b09ea1384b244aa9b27a60cd85c5b838bc70614dc7440a53d7eeea8f7f539f43bf17fa490c222388471f27872936e580ec34143c569d9c744467a8008cb0762d2ed201ba6b42074a955658313e051716b630434150f72a2b74211387ae0cea449411a965b246ec0c4cd2caef4ad6b793cc85fe6b5982499a45c12f9ab06e2b214cd0e8f3bb77e27d2355244bb248e921aff12a2743219fd16ee9307b7c83563496be84b12a1526780e395ff29434982d7dc3bbf1e318fc2bb5449693a38490255a43615064d3089133e96ba821435bdc5979bd9713332cc4214e26e05404e986af137fcf1df55863bf876501b2f25fd7c5d36d8cb19a6179096b5b84fa2270efcf34fc58e8236c9ea1a8c3461b42fd11165f42c910f
##
# (C) Tenable, Inc.
##

include('deprecated_nasl_level.inc');
include("compat.inc");

if (description)
{
  script_id(385858);
  script_version("1.1");

  script_name(english:"OpenShift Vulnerability Detection Data Collection");
  script_summary(english:"Collects OpenShift ClusterVersion and Node data using the OpenShift/Kubernetes REST API.");

  script_set_attribute(attribute:"synopsis",
                       value:"Collects OpenShift cluster and node version data using REST APIs.");
  script_set_attribute(attribute:"description",
                       value:"Collects OpenShift cluster and node version data using REST APIs.");
  script_set_attribute(attribute:"solution", value:"n/a");

  script_set_attribute(attribute:"plugin_publication_date", value:"2026/11/24");
  script_set_attribute(attribute:"plugin_modification_date", value:"2026/11/24");
  script_set_attribute(attribute:"risk_factor", value:"None");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"x-cpe:/a:redhat:openshift");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2026 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"Misc.");

  script_dependencies("openshift_integration_settings.nasl");

  script_require_keys("Host/OpenShiftIntegration/Host",
                       "Host/OpenShiftIntegration/Port",
                       "Host/OpenShiftIntegration/UseSSL",
                       "Host/OpenShiftIntegration/VerifySSL",
                       "Secret/OpenShiftIntegration/Token");

  script_timeout(0);

  exit(0);
}

if (!defined_func("inject_host") && defined_func("nasl_level") && nasl_level() <= 190200)
{
  exit(0, "Nessus older than 10.2");
}

include("compat_shared.inc");
include("audit.inc");
include("http.inc");
include("openshift_detect.inc");
include("resolv_func.inc");
include("ssl_funcs.inc");
include("spad_log_func.inc");

if (defined_func("set_mem_limits"))
{
  set_mem_limits(max_alloc_size:1024*1024*1024, max_program_size:1024*1024*1024);
}

##
# Wrapper for the collection process.
##
function collect()
{
  var config = openshift_detect::init();

  # CollectionIP is whichever target took the mutex; ClusterIP is the API Server Host as an IP.
  var cluster_ip = config['host'];
  var resolved = fqdn_resolv(name:config['host'], ipv6:FALSE, fqdn:TRUE);
  if (!empty_or_null(resolved))
    cluster_ip = resolved[0];

  set_global_kb_item(name:"OpenShiftVulnDetect/DataCollection/CollectionIP", value:get_host_ip());
  set_global_kb_item(name:"OpenShiftVulnDetect/DataCollection/ClusterIP", value:cluster_ip);

  # This function sets items in the global KB, keyed by the API Server Host address.
  var collect_result = openshift_detect::collect(config:config, api_server_ip:cluster_ip);

  if (!collect_result.success)
  {
    openshift_detect::log(msg:"[Error] Collection failed.", lvl:1, config:config);
    return {success:FALSE};
  }

  var kb = { "host/injected/integration": "OpenShift" };

  # The API Server Host is always injected regardless of auto-discovery setting,
  # so the cluster report always appears. Injected by IP: a round-robin hostname can resolve
  # to a different address than ClusterIP, which would skip the cluster report and 122502.
  inject_host(hostname:cluster_ip, kb:kb);

  # Auto-Discovery: inject every collected RHCOS node when the checkbox is on.
  # With the checkbox off, only the API Server Host is injected.
  if (config['auto_discover_nodes'])
  {
    var injected = 0;

    # Hard limit: at most 3000 RHCOS nodes per cluster.
    var rhcos_node_count = 0;
    foreach (var candidate_ip in keys(collect_result.hosts_to_inject))
    {
      if (candidate_ip != cluster_ip && "127.0.0.1" >!< candidate_ip)
        rhcos_node_count++;
    }
    if (rhcos_node_count > 3000)
    {
      openshift_detect::log(
        msg:'[Error] This cluster has ' + rhcos_node_count + ' RHCOS nodes, which exceeds the supported limit of ' +
            '3000. No nodes were injected.',
        lvl:1, config:config);
      return {success:FALSE};
    }

    foreach (var ip in keys(collect_result.hosts_to_inject))
    {
      if (ip == cluster_ip || "127.0.0.1" >< ip) continue;
      openshift_detect::log(msg:"Injecting Discovered OpenShift " +
        collect_result.hosts_to_inject[ip] + " -> " + ip + '\n', lvl:3, config:config);
      inject_host(hostname:ip, kb:kb);
      injected++;
    }

    if (!injected)
      openshift_detect::log(msg:"Auto-discovery: no RHCOS nodes were injected.", lvl:1, config:config);
  }

  return {success:TRUE};
}

mutex_lock(SCRIPT_NAME);

if (empty_or_null(get_global_kb_item("OpenShiftVulnDetect/collected")))
{
  var res = collect();
  set_global_kb_item(name:"OpenShiftVulnDetect/collected", value:res.success);
}
else
{
  var collection_ip = get_global_kb_item("OpenShiftVulnDetect/DataCollection/CollectionIP");
  spad_log(message:"OpenShift Vulnerability Detection data has already been collected. Check results from " +
    collection_ip + " for the debugging log.");
}

mutex_unlock(SCRIPT_NAME);

# Must run here: inject_host() gives each injected host a fresh per-host KB.
var _cluster_ip = get_global_kb_item("OpenShiftVulnDetect/DataCollection/ClusterIP");
var _ocp_port = get_kb_item("Host/OpenShiftIntegration/Port");
if (!empty_or_null(_ocp_port) && get_host_ip() == _cluster_ip)
  lcx::load_pm_issues_to_kb(pm_prod:lcx::PM_PROD_OPENSHIFT, port:_ocp_port, proto:lcx::PROTO_REST);

var collected = get_global_kb_item_or_exit(
  "OpenShiftVulnDetect/collected", exit_code:1,
  msg:"Data collection for OpenShift Vulnerability Detection failed.");

if (!collected)
{
  var msg = "No information was collected from the OpenShift API.";
  report_error(title:"Unable to collect OpenShift data", message:msg, severity:1);

  exit(1, msg);
}

var target_ip = get_host_ip();

var cluster_ip = get_global_kb_item("OpenShiftVulnDetect/Cluster/" + target_ip + "/ip");
var node_ip = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/ip");
var openshift_port = get_kb_item("Host/OpenShiftIntegration/Port");

var auto_discover = get_kb_item('Host/OpenShiftIntegration/AutoDiscoverNodes');
if (isnull(auto_discover))
  auto_discover = TRUE;

var report;

# Reports cluster/API-server data.
if (!empty_or_null(cluster_ip))
{
  var cluster_version = get_global_kb_item("OpenShiftVulnDetect/Cluster/" + target_ip + "/ClusterVersion");
  var node_count = get_global_kb_item("OpenShiftVulnDetect/Cluster/" + target_ip + "/NodeCount");

  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/ip", value:cluster_ip);
  if (!empty_or_null(cluster_version))
  {
    set_kb_item(name:"Host/OS/OpenShift", value:"Red Hat OpenShift Container Platform " + cluster_version);
    set_kb_item(name:"Host/OS/OpenShift/Confidence", value:100);
    set_kb_item(name:"Host/OS/OpenShift/Type", value:"general-purpose");
  }
  report = 'Collected OpenShift Data\n\n';

  if (empty_or_null(cluster_version))
    report += 'ClusterVersion: not collected\n';
  else
  {
    set_kb_item(name:"Host/OpenShiftVulnDetect/Data/ClusterVersion", value:cluster_version);
    report += 'ClusterVersion: ' + cluster_version + '\n';
  }

  if (!isnull(node_count))
  {
    set_kb_item(name:"Host/OpenShiftVulnDetect/Data/NodeCount", value:node_count);
    report += 'Total Nodes: ' + node_count + '\n';
  }

  # Cluster-level node inventory — belongs on the cluster target, the only host with the full picture.
  var node_name_kbs = get_global_kb_list("OpenShiftVulnDetect/Nodes/*/Name");
  if (!empty_or_null(node_name_kbs))
  {
    report += '\nCluster Node Inventory\n\n';
    foreach var name_key (sort(keys(node_name_kbs)))
    {
      var inv_matches = pregmatch(pattern:"OpenShiftVulnDetect/Nodes/([^/]+)/Name$", string:name_key);
      if (isnull(inv_matches)) continue;
      var inv_ip = inv_matches[1];

      report +=
        '  Name: ' + node_name_kbs[name_key] + '\n' +
        '  IP Address: ' + inv_ip + '\n';

      var inv_roles = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + inv_ip + "/Roles");
      if (!empty_or_null(inv_roles))
        report += '  Roles: ' + inv_roles + '\n';

      var inv_os_image = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + inv_ip + "/OsImage");
      if (!empty_or_null(inv_os_image))
        report += '  OS Image: ' + inv_os_image + '\n';

      report += '\n';
    }
  }

  # Compares each node's RHCOS build against the one the cluster expects it to run.
  var os_cmp = openshift_detect::compare_node_os_to_cluster();
  report += '\nNode RHCOS vs Cluster Expected Configuration\n\n';

  if (!os_cmp.drift)
  {
    report += '  All ' + os_cmp.node_total + ' node(s) are running the configuration the cluster expects.\n';
  }
  else
  {
    report +=
      '  The following node(s) are NOT running the configuration the cluster expects.\n' +
      '  A node in this state is still on its previous RHCOS build, so its kernel and\n' +
      '  container runtime are older than the cluster version implies.\n\n';

    foreach var drift_node (os_cmp.out_of_sync)
    {
      report +=
        '  Name       : ' + drift_node.name + '\n' +
        '  IP Address : ' + drift_node.ip + '\n';

      if (!empty_or_null(drift_node.os_image))
        report += '  OS Image   : ' + drift_node.os_image + '\n';
      if (!empty_or_null(drift_node.state))
        report += '  MCO State  : ' + drift_node.state + '\n';
      if (!empty_or_null(drift_node.current_config))
        report += '  Running    : ' + drift_node.current_config + '\n';
      if (!empty_or_null(drift_node.desired_config))
        report += '  Expected   : ' + drift_node.desired_config + '\n';

      report += '\n';
    }
  }

  security_report_v4(port:openshift_port, extra:report, severity:SECURITY_NOTE);
}
# Reports node data. Deliberately independent of the cluster branch above: a host that
# is both the API server and a RHCOS node (compact clusters) runs BOTH branches.
if (!empty_or_null(node_ip))
{
  var name = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/Name");
  var os_image = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/OsImage");
  var kernel_version = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/KernelVersion");
  var kubelet_version = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/KubeletVersion");
  var container_runtime_version =
    get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/ContainerRuntimeVersion");
  var architecture = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/Architecture");
  var roles = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/Roles");
  var mco_state = get_global_kb_item("OpenShiftVulnDetect/Nodes/" + target_ip + "/MCOState");

  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/Ip", value:node_ip);
  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/Name", value:name);
  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/OsImage", value:os_image);
  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/KernelVersion", value:kernel_version);
  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/KubeletVersion", value:kubelet_version);
  set_kb_item(
    name:"Host/OpenShiftVulnDetect/Data/Node/ContainerRuntimeVersion",
    value:container_runtime_version);
  set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/Architecture", value:architecture);
  if (!empty_or_null(roles))
    set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/Roles", value:roles);
  if (!empty_or_null(mco_state))
    set_kb_item(name:"Host/OpenShiftVulnDetect/Data/Node/MCOState", value:mco_state);

  # replace_kb_item: on compact clusters the cluster branch above already set these.
  if (!empty_or_null(os_image))
  {
    replace_kb_item(name:"Host/OS/OpenShift", value:os_image);
    replace_kb_item(name:"Host/OS/OpenShift/Confidence", value:100);
    replace_kb_item(name:"Host/OS/OpenShift/Type", value:"general-purpose");
  }

  # Feeds the rhcos-RHSA fleet contract (rpm-list, installed_os, cpu, local checks) so
  # the advisory plugins fire on this node without SSH. All-or-nothing; the reason is
  # logged either way.
  var fleet = openshift_detect::feed_rhcos_fleet(node_ip:node_ip);
  if (fleet.fed)
    spad_log(message:"OpenShift fleet-feeding: " + fleet.reason + " for node " + node_ip);
  else
    spad_log(message:"OpenShift fleet-feeding skipped for node " + node_ip + ": " + fleet.reason);

  report =
    'Collected OpenShift Data :\n\n' +
    'IP Address: ' + node_ip + '\n' +
    'Name: ' + name + '\n' +
    'OS Image: ' + os_image + '\n' +
    'Kernel Version: ' + kernel_version + '\n' +
    'Kubelet Version: ' + kubelet_version + '\n' +
    'Container Runtime Version: ' + container_runtime_version + '\n' +
    'Architecture: ' + architecture + '\n';

  if (!empty_or_null(roles))
    report += 'Roles: ' + roles + '\n';
  if (!empty_or_null(mco_state))
    report += 'Machine Config State: ' + mco_state + '\n';

  security_report_v4(port:openshift_port, extra:report, severity:SECURITY_NOTE);
}

# Manual-target mode: report an explanation for unrecognized targets instead of silence.
if (empty_or_null(cluster_ip) && empty_or_null(node_ip) && !auto_discover)
{
  report =
    'OpenShift credentials are configured for this scan, but this host was not identified ' +
    'by collection as part of the target cluster.\n\n' +
    'Verify that this host belongs to the configured cluster and that the target address ' +
    'matches a cluster node IP address or the API Server Host credential field. Automatic ' +
    'node discovery is disabled, so only addresses matching the collected inventory are integrated.';

  security_report_v4(port:openshift_port, extra:report, severity:SECURITY_NOTE);
}

set_kb_item(name:"Host/OpenShiftVulnDetect/DataCollection/ran", value:TRUE);

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 Nov 2026 00:00Current
5.9Medium risk
Vulners AI Score5.9
10