Vulnerabilities > CVE-2020-1602 - OS Command Injection vulnerability in Juniper Junos

047910
CVSS 8.3 - HIGH
Attack vector
ADJACENT_NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
low complexity
juniper
CWE-78
nessus

Summary

When a device using Juniper Network's Dynamic Host Configuration Protocol Daemon (JDHCPD) process on Junos OS or Junos OS Evolved which is configured in relay mode it vulnerable to an attacker sending crafted IPv4 packets who may remotely take over the code execution of the JDHDCP process. This issue affect IPv4 JDHCPD services. This issue affects: Juniper Networks Junos OS: 15.1 versions prior to 15.1R7-S6; 15.1X49 versions prior to 15.1X49-D200; 15.1X53 versions prior to 15.1X53-D592; 16.1 versions prior to 16.1R7-S6; 16.2 versions prior to 16.2R2-S11; 17.1 versions prior to 17.1R2-S11, 17.1R3-S1; 17.2 versions prior to 17.2R2-S8, 17.2R3-S3; 17.3 versions prior to 17.3R3-S6; 17.4 versions prior to 17.4R2-S7, 17.4R3; 18.1 versions prior to 18.1R3-S8; 18.2 versions prior to 18.2R3-S2; 18.2X75 versions prior to 18.2X75-D60; 18.3 versions prior to 18.3R1-S6, 18.3R2-S2, 18.3R3; 18.4 versions prior to 18.4R1-S5, 18.4R2-S3, 18.4R3; 19.1 versions prior to 19.1R1-S3, 19.1R2; 19.2 versions prior to 19.2R1-S3, 19.2R2*. and All versions prior to 19.3R1 on Junos OS Evolved. This issue do not affect versions of Junos OS prior to 15.1, or JDHCPD operating as a local server in non-relay mode.

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Command Delimiters
    An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be concatenated onto a legitimate command with the intent of targeting other resources such as the file system or database. The system that uses a filter or a blacklist input validation, as opposed to whitelist validation is vulnerable to an attacker who predicts delimiters (or combinations of delimiters) not present in the filter or blacklist. As with other injection attacks, the attacker uses the command delimiter payload as an entry point to tunnel through the application and activate additional attacks through SQL queries, shell commands, network scanning, and so on.
  • Exploiting Multiple Input Interpretation Layers
    An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic. This exploit relies on the target making multiples passes over the input data and processing a "layer" of special characters with each pass. In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps. The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.
  • Argument Injection
    An attacker changes the behavior or state of a targeted application through injecting data or command syntax through the targets use of non-validated and non-filtered arguments of exposed services or methods.
  • OS Command Injection
    In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.

Nessus

  • NASL familyJunos Local Security Checks
    NASL idJUNIPER_JSA10981.NASL
    descriptionAccording to its self-reported version number, the remote Juniper Junos device is affected by multiple vulnerabilities: - When a device using Juniper Network
    last seen2020-06-10
    modified2020-02-24
    plugin id133863
    published2020-02-24
    reporterThis script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/133863
    titleJunos OS Multiple vulnerabilities (JSA10981)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include('compat.inc');
    
    if (description)
    {
      script_id(133863);
      script_version("1.2");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/09");
    
      script_cve_id(
          "CVE-2020-1602",
          "CVE-2020-1605",
          "CVE-2020-1609"
        );
      script_xref(name:"JSA", value:"JSA10981");
    
      script_name(english:"Junos OS Multiple vulnerabilities (JSA10981)");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote device is missing a vendor-supplied security patch.");
      script_set_attribute(attribute:"description", value:
    "According to its self-reported version number, the remote Juniper Junos device is affected by 
    multiple vulnerabilities:
        - When a device using Juniper Network's Dynamic Host Configuration Protocol Daemon (JDHCPD)
          process on Junos OS or Junos OS Evolved which is configured in relay mode it vulnerable to
          an attacker sending crafted IPv4 packets who may remotely take over the code execution of
          the JDHDCP process. (CVE-2020-1602)
    
        - When a device using Juniper Network's Dynamic Host Configuration Protocol Daemon (JDHCPD)
          process on Junos OS or Junos OS Evolved which is configured in relay mode it vulnerable to
          an attacker sending crafted IPv4 packets who may then arbitrarily execute commands as root
          on the target device. This issue affects IPv4 JDHCPD services. (CVE-2020-1605)
    
        - When a device using Juniper Network's Dynamic Host Configuration Protocol Daemon (JDHCPD)
          process on Junos OS or Junos OS Evolved which is configured in relay mode it vulnerable to
          an attacker sending crafted IPv6 packets who may then arbitrarily execute commands as root
          on the target device. This issue affects IPv6 JDHCPD services. (CVE-2020-1609)
    
    Note that Nessus has not tested for this issue but has instead relied only on the application's 
    self-reported version number.");
      script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/InfoCenter/index?page=content&id=JSA10981");
      script_set_attribute(attribute:"solution", value:
    "Apply the relevant Junos software release referenced in Juniper advisory JSA10981.");
      script_set_cvss_base_vector("CVSS2#AV:A/AC:L/Au:N/C:C/I:C/A:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_attribute(attribute:"cvss_score_source", value:"CVE-2020-1605");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2020/01/08");
      script_set_attribute(attribute:"patch_publication_date", value:"2020/01/08");
      script_set_attribute(attribute:"plugin_publication_date", value:"2020/02/24");
    
      script_set_attribute(attribute:"plugin_type", value:"combined");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:juniper:junos");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Junos Local Security Checks");
    
      script_dependencies("junos_version.nasl");
      script_require_keys("Host/Juniper/JUNOS/Version");
      exit(0);
    }
    
    include('junos.inc');
    include('misc_func.inc');
    include('junos_kb_cmd_func.inc');
    
    ver = get_kb_item_or_exit('Host/Juniper/JUNOS/Version');
    
    fixes = make_array();
    
    fixes['15.1R'] = '15.1R7-S6';
    fixes['15.1X49'] = '15.1X49-D200';
    fixes['15.1X53'] = '15.1X53-D592';
    fixes['16.1'] = '16.1R7-S6';
    fixes['16.2'] = '16.2R2-S11';
    fixes['17.1'] = '17.1R2-S11';
    fixes['17.2'] = '17.2R2-S8';
    fixes['17.3'] = '17.3R3-S6';
    fixes['17.4'] = '17.4R2-S7';
    fixes['18.1'] = '18.1R3-S8';
    fixes['18.2'] = '18.2R3-S2';
    fixes['18.2X75'] = '18.2X75-D60';
    fixes['18.3'] = '18.3R1-S6';
    fixes['18.4'] = '18.4R1-S5';
    fixes['19.1'] = '19.1R1-S3';
    fixes['19.2'] = '19.2R1-S3';
    
    fix = check_junos(ver:ver, fixes:fixes, exit_on_fail:TRUE);
    
    
    # If forwarding-options dhcp-relay, audit out.
    override = TRUE;
    buf = junos_command_kb_item(cmd:'show configuration | display set');
    if (buf)
    {
      override = FALSE;
      pattern = "^set forwarding-options dhcp-relay";
      if (!junos_check_config(buf:buf, pattern:pattern))
        audit(AUDIT_HOST_NOT, 'vulnerable');
    }
    junos_report(ver:ver, fix:fix, override:override, severity:SECURITY_HOLE);
  • NASL familyJunos Local Security Checks
    NASL idJUNIPER_JSA10979.NASL
    descriptionThe version of tested product installed on the remote host is prior to tested version. It is, therefore, affected by a vulnerability as referenced in the JSA10979 advisory. Note that Nessus has not tested for this issue but has instead relied only on the application
    last seen2020-05-06
    modified2020-02-25
    plugin id133965
    published2020-02-25
    reporterThis script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/133965
    titleJuniper JSA10979
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include('compat.inc');
    
    if (description)
    {
      script_id(133965);
      script_version("1.2");
    
      script_cve_id(
        "CVE-2020-1600",
        "CVE-2020-1601",
        "CVE-2020-1602",
        "CVE-2020-1603",
        "CVE-2020-1604",
        "CVE-2020-1605",
        "CVE-2020-1607",
        "CVE-2020-1608",
        "CVE-2020-1609"
      );
      script_xref(name:"IAVA", value:"2020-A-0012");
    
      script_name(english:"Juniper JSA10979");
      script_summary(english:"Checks the Junos version and build date.");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote device is missing a vendor-supplied security patch.");
      script_set_attribute(attribute:"description", value:
    "The version of tested product installed on the remote host is prior to
    tested version. It is, therefore, affected by a vulnerability as
    referenced in the JSA10979 advisory. Note that Nessus has not tested
    for this issue but has instead relied only on the application's self-
    reported version number.");
      script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/KB16613");
      script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/KB16765");
      script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/KB16446");
      script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/JSA10979");
      script_set_attribute(attribute:"solution", value:
    "Apply the relevant Junos software release referenced in Juniper
    advisory JSA10979");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:N/I:N/A:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H");
      script_set_attribute(attribute:"cvss_score_source", value:"CVE-2020-1600");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2020/01/08");
      script_set_attribute(attribute:"patch_publication_date", value:"2020/01/08");
      script_set_attribute(attribute:"plugin_publication_date", value:"2020/02/25");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/05/05");
    
      script_set_attribute(attribute:"plugin_type", value:"combined");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:juniper:junos");
      script_set_attribute(attribute:"stig_severity", value:"I");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"Junos Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("junos_version.nasl");
      script_require_keys("Host/Juniper/JUNOS/Version", "Host/Juniper/model");
    
      exit(0);
    }
    
    include('audit.inc');
    include('junos.inc');
    include('misc_func.inc');
    
    ver = get_kb_item_or_exit('Host/Juniper/JUNOS/Version');
    model = get_kb_item_or_exit('Host/Juniper/model');
    fixes = make_array();
    
    fixes["12.3X48"] = "12.3X48-D90";
    fixes["15.1"] = "15.1R7-S6";
    fixes["15.1X49"] = "15.1X49-D200";
    fixes["15.1X53"] = "15.1X53-D238";
    fixes["16.1"] = "16.1R7-S5";
    fixes["16.2"] = "16.2R2-S11";
    fixes["17.1"] = "17.1R3-S1";
    fixes["17.2"] = "17.2R3-S2";
    fixes["17.3"] = "17.3R3-S7";
    fixes["17.4"] = "17.4R2-S4";
    fixes["18.1"] = "18.1R3-S5";
    fixes["18.2"] = "18.2R3";
    fixes["18.2X75"] = "18.2X75-D50";
    fixes["18.3"] = "18.3R2";
    fixes["18.4"] = "18.4R1-S6";
    fixes["19.1"] = "19.1R2";
    
    fix = check_junos(ver:ver, fixes:fixes, exit_on_fail:TRUE);
    
    report = get_report(ver:ver, fix:fix);
    
    security_report_v4(severity:SECURITY_WARNING, port:0, extra:report);