CVE-2018-12520 (published 2018-07-05T20:29Z)

An issue was discovered in ntopng 3.4 before 3.4.180617. The PRNG involved in the generation of session IDs is not seeded at program startup. This results in deterministic session IDs being allocated for active user sessions. An attacker with foreknowledge of the operating system and standard library in use by the host running the service and the username of the user whose session they're targeting can abuse the deterministic random number generation in order to hijack the user's session, thus escalating their access.

Severity: MEDIUM
CVSS v2 base score: 6.8 (AV:N/AC:M/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 8.1, HIGH (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-335
cwe_name: Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG)
description: The product uses a Pseudo-Random Number Generator (PRNG) but does not correctly manage seeds.
extended_description: 
		   
		   PRNGs are deterministic and, while their output appears
		   random, they cannot actually create entropy. They rely on
		   cryptographically secure and unique seeds for entropy so
		   proper seeding is critical to the secure operation of the
		   PRNG.
		   
		   Management of seeds could be broken down into two main areas:
		   
		   
			 
		   (1) protecting seeds as cryptographic material (such as a cryptographic key);
			 
			 
		   (2) whenever possible, using a uniquely generated seed from
		   a cryptographically secure source
			 
		   
			 
			   PRNGs require a seed as input to generate a stream of
			   numbers that are functionally indistinguishable from
			   random numbers.  While the output is, in many cases,
			   sufficient for cryptographic uses, the output of any
			   PRNG is directly determined by the seed provided as
			   input. If the seed can be ascertained by a third party,
			   the entire output of the PRNG can be made known to
			   them. As such, the seed should be kept secret and
			   should ideally not be able to be guessed. For example,
			   the current time may be a poor seed. Knowing the
			   approximate time the PRNG was seeded greatly reduces
			   the possible key space.
			 
			 
			   Seeds do not necessarily need to be unique, but reusing seeds may open up attacks if the seed is discovered.
			 
		 
         

Fix information:
repo_url: https://github.com/ntop/ntopng
commit_details: repo_url: https://github.com/ntop/ntopng
author: Luca Deri
author_date: 2018-06-17 15:24:25+02:00
msg: Added code to randomize values returned by rand()
repository: repo_url: https://github.com/ntop/ntopng
repo_name: ntop/ntopng
description: Web-based Traffic and Security Network Traffic Monitoring
repo_language: Lua
owner: ntop
file_changes: filename: HTTPserver.cpp
change_type: ModificationType.MODIFY
diff: @@ -864,7 +864,12 @@ HTTPserver::HTTPserver(const char *_docs_dir, const char *_scripts_dir) {
   bool use_http = true;
   struct stat statsBuf;
   int stat_rc;
+  struct timeval tv;
 
+  /* Randomize data */
+  gettimeofday(&tv, NULL);
+  srand(tv.tv_sec + tv.tv_usec);
+  
   static char *http_options[] = {
     (char*)"listening_ports", ports,
     (char*)"enable_directory_listing", (char*)"no",

programming_language: C++