CVE-2018-0007 - Improper Control of Generation of Code ('Code Injection')

Severity

99%

Complexity

99%

Confidentiality

165%

An unauthenticated network-based attacker able to send a maliciously crafted LLDP packet to the local segment, through a local segment broadcast, may be able to cause a Junos device to enter an improper boundary check condition allowing a memory corruption to occur, leading to a denial of service. Further crafted packets may be able to sustain the denial of service condition. Score: 6.5 MEDIUM (CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) Further, if the attacker is authenticated on the target device receiving and processing the malicious LLDP packet, while receiving the crafted packets, the attacker may be able to perform command or arbitrary code injection over the target device thereby elevating their permissions and privileges, and taking control of the device. Score: 7.8 HIGH (CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) An unauthenticated network-based attacker able to send a maliciously crafted LLDP packet to one or more local segments, via LLDP proxy / tunneling agents or other LLDP through Layer 3 deployments, through one or more local segment broadcasts, may be able to cause multiple Junos devices to enter an improper boundary check condition allowing a memory corruption to occur, leading to multiple distributed Denials of Services. These Denials of Services attacks may have cascading Denials of Services to adjacent connected devices, impacts network devices, servers, workstations, etc. Further crafted packets may be able to sustain these Denials of Services conditions. Score 6.8 MEDIUM (CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:H) Further, if the attacker is authenticated on one or more target devices receiving and processing these malicious LLDP packets, while receiving the crafted packets, the attacker may be able to perform command or arbitrary code injection over multiple target devices thereby elevating their permissions and privileges, and taking control multiple devices. Score: 7.8 HIGH (CVSS:3.0/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H) Affected releases are Juniper Networks Junos OS: 12.1X46 versions prior to 12.1X46-D71; 12.3 versions prior to 12.3R12-S7; 12.3X48 versions prior to 12.3X48-D55; 14.1 versions prior to 14.1R8-S5, 14.1R9; 14.1X53 versions prior to 14.1X53-D46, 14.1X53-D50, 14.1X53-D107; 14.2 versions prior to 14.2R7-S9, 14.2R8; 15.1 versions prior to 15.1F2-S17, 15.1F5-S8, 15.1F6-S8, 15.1R5-S7, 15.1R7; 15.1X49 versions prior to 15.1X49-D90; 15.1X53 versions prior to 15.1X53-D65; 16.1 versions prior to 16.1R4-S6, 16.1R5; 16.1X65 versions prior to 16.1X65-D45; 16.2 versions prior to 16.2R2; 17.1 versions prior to 17.1R2. No other Juniper Networks products or platforms are affected by this issue.

An unauthenticated network-based attacker able to send a maliciously crafted LLDP packet to the local segment, through a local segment broadcast, may be able to cause a Junos device to enter an improper boundary check condition allowing a memory corruption to occur, leading to a denial of service. Further crafted packets may be able to sustain the denial of service condition. Score: 6.5 MEDIUM (CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) Further, if the attacker is authenticated on the target device receiving and processing the malicious LLDP packet, while receiving the crafted packets, the attacker may be able to perform command or arbitrary code injection over the target device thereby elevating their permissions and privileges, and taking control of the device. Score: 7.8 HIGH (CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) An unauthenticated network-based attacker able to send a maliciously crafted LLDP packet to one or more local segments, via LLDP proxy / tunneling agents or other LLDP through Layer 3 deployments, through one or more local segment broadcasts, may be able to cause multiple Junos devices to enter an improper boundary check condition allowing a memory corruption to occur, leading to multiple distributed Denials of Services. These Denials of Services attacks may have cascading Denials of Services to adjacent connected devices, impacts network devices, servers, workstations, etc. Further crafted packets may be able to sustain these Denials of Services conditions. Score 6.8 MEDIUM (CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:H) Further, if the attacker is authenticated on one or more target devices receiving and processing these malicious LLDP packets, while receiving the crafted packets, the attacker may be able to perform command or arbitrary code injection over multiple target devices thereby elevating their permissions and privileges, and taking control multiple devices. Score: 7.8 HIGH (CVSS:3.0/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H) Affected releases are Juniper Networks Junos OS: 12.1X46 versions prior to 12.1X46-D71; 12.3 versions prior to 12.3R12-S7; 12.3X48 versions prior to 12.3X48-D55; 14.1 versions prior to 14.1R8-S5, 14.1R9; 14.1X53 versions prior to 14.1X53-D46, 14.1X53-D50, 14.1X53-D107; 14.2 versions prior to 14.2R7-S9, 14.2R8; 15.1 versions prior to 15.1F2-S17, 15.1F5-S8, 15.1F6-S8, 15.1R5-S7, 15.1R7; 15.1X49 versions prior to 15.1X49-D90; 15.1X53 versions prior to 15.1X53-D65; 16.1 versions prior to 16.1R4-S6, 16.1R5; 16.1X65 versions prior to 16.1X65-D45; 16.2 versions prior to 16.2R2; 17.1 versions prior to 17.1R2. No other Juniper Networks products or platforms are affected by this issue.

CVSS 3.0 Base Score 9.8. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

CVSS 2.0 Base Score 9.9. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (AV:N/AC:L/Au:N/C:C/I:C/A:C).

Demo Examples

Improper Control of Generation of Code ('Code Injection')

CWE-94

This example attempts to write user messages to a message file and allow users to view them.


               
}
echo "Message Saved!<p>\n";
include($MessageFile);

While the programmer intends for the MessageFile to only include data, an attacker can provide a message such as:


               
message=%3C?php%20system(%22/bin/ls%20-l%22);?%3E

which will decode to the following:


               
<?php system("/bin/ls -l");?>

The programmer thought they were just including the contents of a regular data file, but PHP parsed it and executed the code. Now, this code is executed any time people view messages.

Notice that XSS (CWE-79) is also possible in this situation.

Improper Control of Generation of Code ('Code Injection')

CWE-94

edit-config.pl: This CGI script is used to modify settings in a configuration file.


               
}
# code to add a field/key to a file goes here
# code to set key to a particular file goes here
# code to delete key from a particular file goes here
eval($code);# this is super-efficient code, especially if you have to invoke# any one of dozens of different functions!
handleConfigAction($configfile, param('action'));
print "No action specified!\n";

The script intends to take the 'action' parameter and invoke one of a variety of functions based on the value of that parameter - config_file_add_key(), config_file_set_key(), or config_file_delete_key(). It could set up a conditional to invoke each function separately, but eval() is a powerful way of doing the same thing in fewer lines of code, especially when a large number of functions or variables are involved. Unfortunately, in this case, the attacker can provide other values in the action parameter, such as: add_key(",","); system("/bin/ls"); This would produce the following string in handleConfigAction(): config_file_add_key(",","); system("/bin/ls"); Any arbitrary Perl code could be added after the attacker has "closed off" the construction of the original function call, in order to prevent parsing errors from causing the malicious eval() to fail before the attacker's payload is activated. This particular manipulation would fail after the system() call, because the "_key(\$fname, \$key, \$val)" portion of the string would cause an error, but this is irrelevant to the attack because the payload has already been activated.

Overview

Type

Juniper

First reported 7 years ago

2018-01-10 22:29:00

Last updated 7 years ago

2018-02-02 19:25:00

Affected Software

Juniper JUNOS 12.1X46

12.1x46

Juniper Junos 12.1x46 D10

12.1x46

Juniper Junos 12.1x46 D15

12.1x46

Juniper JUNOS 12.1X46-D20

12.1x46

Juniper Junos 12.1x46 D25

12.1x46

Juniper JunOS 12.1x46 D30

12.1x46

Juniper JunOS 12.1x46 D35

12.1x46

Juniper JunOS 12.1x46 D40

12.1x46

Juniper Junos 12.1X46 D45

12.1x46

Juniper Junos 12.1X46 D50

12.1x46

Juniper JunOS 12.1X46 D55

12.1x46

Juniper JunOS 12.1X46 D60

12.1x46

Juniper Junos 12.1X46 D65

12.1x46

Juniper JUNOS 12.3

12.3

Juniper Junos 12.3 R1

12.3

Juniper JunOS 12.3 R10

12.3

Juniper Junos 12.3 R11

12.3

Juniper JunOS 12.3 R12

12.3

Juniper Junos 12.3 R2

12.3

Juniper Junos 12.3 R3

12.3

Juniper Junos 12.3 R4

12.3

Juniper Junos 12.3 R5

12.3

Juniper Junos 12.3 R6

12.3

Juniper JUNOS 12.3R7

12.3

Juniper Junos 12.3 R8

12.3

Juniper JunOS 12.3 R9

12.3

Juniper JunOS 12.3x48 D10

12.3x48

Juniper JunOS 12.3x48 D15

12.3x48

Juniper Junos OS 12.3X48 D20

12.3x48

Juniper Junos 12.3X48 D25

12.3x48

Juniper Junos OS 12.3X48 D30

12.3x48

Juniper Junos OS 12.3X48 D35

12.3x48

Juniper Junos OS 12.3X48 D40

12.3x48

Juniper Junos OS 12.3X48 D45

12.3x48

Juniper Junos OS 12.3X48 D50

12.3x48

Juniper JUNOS 14.1

14.1

Juniper JUNOS 14.1R1

14.1

Juniper Junos 14.1 R2

14.1

Juniper Junos 14.1 R3

14.1

Juniper JunOS 14.1 R4

14.1

Juniper Junos 14.1 R5

14.1

Juniper Junos 14.1 R6

14.1

Juniper Junos 14.1 R7

14.1

Juniper JunOS 14.1 R8

14.1

Juniper JunOS 14.1 R9

14.1

Juniper JunOS 14.1x53

14.1x53

Juniper JunOS 14.1x53 D10

14.1x53

Juniper JunOS 14.1x53 D15

14.1x53

Juniper JunOS 14.1x53 D16

14.1x53

Juniper JunOS 14.1x53 D25

14.1x53

Juniper JunOS 14.1x53 D26

14.1x53

Juniper Junos 14.1X53 D27

14.1x53

Juniper Junos 14.1X53 D30

14.1x53

Juniper Junos 14.1X53 D35

14.1x53

Juniper JunOS 14.1x53 D40

14.1x53

Juniper JunOS 14.1X53 D45

14.1x53

Juniper Junos 14.2 R1

14.2

Juniper Junos 14.2 R2

14.2

Juniper Junos 14.2 R3

14.2

Juniper Junos 14.2 R4

14.2

Juniper Junos 14.2 R5

14.2

Juniper Junos 14.2 R6

14.2

Juniper JunOS 14.2 R7

14.2

Juniper JunOS 15.1 F2

15.1

Juniper Junos 15.1 F5

15.1

Juniper JUNOS 15.1 F6

15.1

Juniper JunOS 15.1 F7

15.1

Juniper Junos OS 15.1 R7

15.1

Juniper JunOS 15.1x49 D10

15.1x49

Juniper JunOS 15.1x49 D20

15.1x49

Juniper JunOS 15.1X49 D30

15.1x49

Juniper Junos 15.1X49 D35

15.1x49

Juniper JunOS 15.1X49 D40

15.1x49

Juniper JunOS 15.1X49 D45

15.1x49

Juniper JunOS 15.1X49 D50

15.1x49

Juniper JunOS 15.1X49 D55

15.1x49

Juniper JunOS 15.1X49 D60

15.1x49

Juniper JunOS 15.1X49 D65

15.1x49

Juniper JunOS 15.1X49 D70

15.1x49

Juniper JunOS 15.1X49 D75

15.1x49

Juniper JunOS 15.1X49 D80

15.1x49

Juniper Junos 15.1X53 D20

15.1x53

Juniper Junos 15.1X53 D21

15.1x53

Juniper JunOS 15.1X53 D210

15.1x53

Juniper JunOS 15.1X53 D25

15.1x53

Juniper Junos 15.1X53 D30

15.1x53

Juniper Junos 15.1X53 D32

15.1x53

Juniper Junos 15.1X53 D33

15.1x53

Juniper Junos 15.1X53 D34

15.1x53

Juniper JunOS 15.1X53 D60

15.1x53

Juniper JunOS 15.1X53 D61

15.1x53

Juniper JunOS 15.1X53 D62

15.1x53

Juniper JunOS 15.1X53 D63

15.1x53

Juniper JunOS 16.1 R1

16.1

Juniper JunOS 16.1 R2

16.1

Juniper JunOS 16.1 R3

16.1

Juniper JunOS 16.1 R4

16.1

Juniper JunOS 16.2 R1

16.2

Juniper JunOS 17.1 R1

17.1

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.