Vulnerabilities > CVE-2016-4922 - Command Injection vulnerability in Juniper Junos
Summary
Certain combinations of Junos OS CLI commands and arguments have been found to be exploitable in a way that can allow unauthorized access to the operating system. This may allow any user with permissions to run these CLI commands the ability to achieve elevated privileges and gain complete control of the device. Affected releases are Juniper Networks Junos OS 11.4 prior to 11.4R13-S3; 12.1X46 prior to 12.1X46-D60; 12.1X47 prior to 12.1X47-D45; 12.3 prior to 12.3R12; 12.3X48 prior to 12.3X48-D35; 13.2 prior to 13.2R9; 13.3 prior to 13.3R4-S11, 13.3R9; 14.1 prior to 14.1R4-S12, 14.1R7; 14.1X53 prior to 14.1X53-D28, 14.1X53-D40; 14.1X55 prior to 14.1X55-D35; 14.2 prior to 14.2R3-S10, 14.2R4-S7, 14.2R5; 15.1 prior to 15.1F4, 15.1R3; 15.1X49 prior to 15.1X49-D60; 15.1X53 prior to 15.1X53-D57, 15.1X53-D70.
Vulnerable Configurations
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Cause Web Server Misclassification An attack of this type exploits a Web server's decision to take action based on filename or file extension. Because different file types are handled by different server processes, misclassification may force the Web server to take unexpected action, or expected actions in an unexpected sequence. This may cause the server to exhaust resources, supply debug or system data to the attacker, or bind an attacker to a remote process. This type of vulnerability has been found in many widely used servers including IIS, Lotus Domino, and Orion. The attacker's job in this case is straightforward, standard communication protocols and methods are used and are generally appended with malicious information at the tail end of an otherwise legitimate request. The attack payload varies, but it could be special characters like a period or simply appending a tag that has a special meaning for operations on the server side like .jsp for a java application server. The essence of this attack is that the attacker deceives the server into executing functionality based on the name of the request, i.e. login.jsp, not the contents.
- LDAP Injection An attacker manipulates or crafts an LDAP query for the purpose of undermining the security of the target. Some applications use user input to create LDAP queries that are processed by an LDAP server. For example, a user might provide their username during authentication and the username might be inserted in an LDAP query during the authentication process. An attacker could use this input to inject additional commands into an LDAP query that could disclose sensitive information. For example, entering a * in the aforementioned query might return information about all users on the system. This attack is very similar to an SQL injection attack in that it manipulates a query to gather additional information or coerce a particular return value.
- 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.
- File System Function Injection, Content Based An attack of this type exploits the host's trust in executing remote content including binary files. The files are poisoned with a malicious payload (targeting the file systems accessible by the target software) by the attacker and may be passed through standard channels such as via email, and standard web content like PDF and multimedia files. The attacker exploits known vulnerabilities or handling routines in the target processes. Vulnerabilities of this type have been found in a wide variety of commercial applications from Microsoft Office to Adobe Acrobat and Apple Safari web browser. When the attacker knows the standard handling routines and can identify vulnerabilities and entry points they can be exploited by otherwise seemingly normal content. Once the attack is executed, the attackers' program can access relative directories such as C:\Program Files or other standard system directories to launch further attacks. In a worst case scenario, these programs are combined with other propagation logic and work as a virus.
- 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.
Nessus
NASL family Junos Local Security Checks NASL id JUNIPER_JSA10763.NASL description According to its self-reported version number, the remote Juniper Junos device is affected by multiple privilege escalation vulnerabilities in the Junos CLI. A local attacker can exploit these, via specially crafted CLI commands and arguments, to gain elevated privileges. last seen 2020-06-01 modified 2020-06-02 plugin id 94332 published 2016-10-27 reporter This script is Copyright (C) 2016-2018 Tenable Network Security, Inc. source https://www.tenable.com/plugins/nessus/94332 title Juniper Junos Multiple CLI Command Handling Local Privilege Escalations (JSA10763) code # # (C) Tenable Network Security, Inc. # include("compat.inc"); if (description) { script_id(94332); script_version("1.8"); script_cvs_date("Date: 2018/07/12 19:01:16"); script_cve_id("CVE-2016-4922"); script_bugtraq_id(93534); script_xref(name:"JSA", value:"JSA10763"); script_name(english:"Juniper Junos Multiple CLI Command Handling Local Privilege Escalations (JSA10763)"); script_summary(english:"Checks the Junos version."); 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 privilege escalation vulnerabilities in the Junos CLI. A local attacker can exploit these, via specially crafted CLI commands and arguments, to gain elevated privileges."); script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/JSA10763"); script_set_attribute(attribute:"solution", value: "Upgrade to the relevant Junos software release referenced in Juniper advisory JSA10763."); script_set_cvss_base_vector("CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C"); script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C"); script_set_cvss3_base_vector("CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"); script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C"); script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available"); script_set_attribute(attribute:"exploit_available", value:"false"); script_set_attribute(attribute:"vuln_publication_date", value:"2016/10/12"); script_set_attribute(attribute:"patch_publication_date", value:"2016/10/12"); script_set_attribute(attribute:"plugin_publication_date", value:"2016/10/27"); 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_family(english:"Junos Local Security Checks"); script_copyright(english:"This script is Copyright (C) 2016-2018 Tenable Network Security, Inc."); script_dependencies("junos_version.nasl"); script_require_keys("Host/Juniper/JUNOS/Version", "Host/Juniper/model"); exit(0); } include("audit.inc"); include("junos_kb_cmd_func.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.1X46'] = '12.1X46-D60'; fixes['12.1X47'] = '12.1X47-D45'; fixes['12.3X48'] = '12.3X48-D35'; fixes['12.3'] = '12.3R12'; fixes['13.2'] = '13.2R9'; fixes['13.3'] = '13.3R9'; fixes['14.1'] = '14.1R7'; fixes['14.1X53'] = '14.1X53-D40'; fixes['14.1X55'] = '14.1X55-D35'; fixes['14.2'] = '14.2R5'; fixes['15.1F'] = '15.1F4'; fixes['15.1R'] = '15.1R3'; fixes['15.1X49'] = '15.1X49-D60'; fixes['15.1X53'] = '15.1X53-D70'; fixes['16.1R'] = '16.1R1'; fix = check_junos(ver:ver, fixes:fixes, exit_on_fail:TRUE); junos_report(ver:ver, fix:fix, model:model, severity:SECURITY_HOLE);
NASL family Junos Local Security Checks NASL id JUNIPER_JSA10762.NASL description According to its self-reported version number and configuration, the remote Juniper Junos device is affected by a denial of service vulnerability in the IPV6 implementation. An unauthenticated, remote attacker can exploit this, via a flood of specially crafted IPv6 traffic, to exhaust available resources or cause a kernel panic. last seen 2020-03-18 modified 2016-10-27 plugin id 94331 published 2016-10-27 reporter This script is Copyright (C) 2016-2018 Tenable Network Security, Inc. source https://www.tenable.com/plugins/nessus/94331 title Juniper Junos IPv6 Packet Handling Remote DoS (JSA10762) code #TRUSTED 6430368b66eeb4d24fc9c8122591f2953e8e0b3c38ce3dfe135f6806d3b5cd42fc2ea6df32c99f7f3032574ff9c4c0098f7726bf631a2248c31eb8fb557ff7bd484019400a5e748addabf7a8c396d53cf4e18fdd5a5de1c108d126c1f6a4e9d905cb6e63a5b19fec891606d9b6a799b921ec3322e9c5e20582bbd4f0c9c96bc29b9a36b1a544895eb5ed8b8a0214da47d3609dfca075fcca06df2c049d015adcaec9aac8c00bff778db084d95f2d37feea472ad1fde552161804b6f3f635183bcf09853d1abf861a781da7024d1635280f34f2c3026e3e58bd204d1118a85f539fab903eb2cd95c69d3060b226efe378fa353e3b79699bf5946a8f9243195425350fadf0b78d2237949048690f77f37243597ab8957c7300e87855e54679f44c822f04c5ce5678ce0a5b421d7c5408f5cfae58362f23bc07834acf7721bd863435bc882a6b74c8d158be86c21b79e70cd8414c593843cb1ab643642e06d3f425033dbd684301241311ce1d02efc7836e4dd306ef61b56701ed4c4f1e8b086ec5079c40f7dc8056600237820f6d28df303f5118eb574b6b8cc6844e7200f8f640f0b9479369f221e364c09c4d1f4fba55528a48dfb993b75befeaad0204bcb94f93dbd6c473b2367fefbcde55d244692bb8e13c60f8e1ddf242477b6bc1a6b5c4d1020444a66d4848a090e48ad8e3b9c93d740aeda1b3bb6c6ae490932fd794e7 # # (C) Tenable Network Security, Inc. # include("compat.inc"); if (description) { script_id(94331); script_version("1.9"); script_set_attribute(attribute:"plugin_modification_date", value:"2018/07/12"); script_cve_id("CVE-2016-4922"); script_bugtraq_id(93534); script_xref(name:"JSA", value:"JSA10762"); script_name(english:"Juniper Junos IPv6 Packet Handling Remote DoS (JSA10762)"); script_summary(english:"Checks the Junos version."); 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 and configuration, the remote Juniper Junos device is affected by a denial of service vulnerability in the IPV6 implementation. An unauthenticated, remote attacker can exploit this, via a flood of specially crafted IPv6 traffic, to exhaust available resources or cause a kernel panic."); script_set_attribute(attribute:"see_also", value:"https://kb.juniper.net/JSA10762"); script_set_attribute(attribute:"solution", value: "Upgrade to the relevant Junos software release referenced in Juniper advisory JSA10762."); script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:N/I:N/A:C"); script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C"); script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"); script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available"); script_set_attribute(attribute:"exploit_available", value:"false"); script_set_attribute(attribute:"vuln_publication_date", value:"2016/10/12"); script_set_attribute(attribute:"patch_publication_date", value:"2016/10/12"); script_set_attribute(attribute:"plugin_publication_date", value:"2016/10/27"); 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_family(english:"Junos Local Security Checks"); script_copyright(english:"This script is Copyright (C) 2016-2018 Tenable Network Security, Inc."); script_dependencies("junos_version.nasl"); script_require_keys("Host/Juniper/JUNOS/Version", "Host/Juniper/model"); exit(0); } include("audit.inc"); include("junos_kb_cmd_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['11.4'] = '11.4R13'; # or 11.4R13-S3 fixes['12.1X44'] = '12.1X44-D45'; fixes['12.1X46'] = '12.1X46-D30'; fixes['12.1X47'] = '12.1X47-D20'; fixes['12.3'] = '12.3R9'; fixes['13.3'] = '13.3R5'; # or 13.3R10 fixes['12.3X48'] = '12.3X48-D30'; fixes['14.1'] = '14.1R8'; fixes['14.1X53'] = '14.1X53-D28'; # or 14.1X53-D40 fixes['14.1X55'] = '14.1X55-D35'; fixes['14.2'] = '14.2R6'; fixes['15.1R'] = '15.1R3'; fixes['15.1F'] = '15.1F5-S2'; # or 15.1F6 fixes['15.1X49'] = '15.1X49-D40'; fixes['15.1X53'] = '15.1X53-D61'; # or 15.1X53-D70 fixes['16.1R'] = '16.1R1'; fix = check_junos(ver:ver, fixes:fixes, exit_on_fail:TRUE); if (fix == "11.4R13") fix += " or 11.4R13-S3"; if (fix == "13.3R5") fix += " or 13.3R10"; if (fix == "14.1X53-D28") fix += " or 14.1X53-D40"; if (fix == "15.1F5-S2") fix += " or 15.1F6"; if (fix == "15.1X53-D61") fix += " or 15.1X53-D70"; override = TRUE; buf = junos_command_kb_item(cmd:"show interfaces"); if (buf) { pattern = "(inet6)"; if (!junos_check_config(buf:buf, pattern:pattern)) audit(AUDIT_HOST_NOT, 'affected because IPv6 traffic is not enabled.'); override = FALSE; } junos_report(ver:ver, fix:fix, model:model, override:override, severity:SECURITY_HOLE);