CVE-2017-20161 (published 2023-01-02T16:15Z)

A vulnerability classified as problematic has been found in rofl0r MacGeiger. Affected is the function dump_wlan_at of the file macgeiger.c of the component ESSID Handler. The manipulation leads to injection. Access to the local network is required for this attack to succeed. The complexity of an attack is rather high. The exploitability is told to be difficult. The name of the patch is 57f1dd50a4821b8c8e676e8020006ae4bfd3c9cb. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217188.

CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-74
cwe_name: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
description: The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
extended_description: Software or other automated logic has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features that classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed.
         

Fix information:
repo_url: https://github.com/rofl0r/MacGeiger
commit_details: repo_url: https://github.com/rofl0r/MacGeiger
author: rofl0r
author_date: 2017-12-02 11:50:10+00:00
msg: sanitize displayed essids

if the ncurses backend is used, having UTF-8 chars in an ESSID could lead to
"funny" unexpected effects, or an attacker might even set up an AP with an ESSID
containing terminal escapes to execute commands on the pentester's box...
repository: repo_url: https://github.com/rofl0r/MacGeiger
repo_name: rofl0r/MacGeiger
description: MacGeiger - a tool to track down the location of WIFI APs with sound (Geigercounter-like)
repo_language: C
owner: rofl0r
file_changes: filename: macgeiger.c
change_type: ModificationType.MODIFY
diff: @@ -563,6 +563,19 @@ static void dump_wlan_info(unsigned wlanidx) {
 	unlock();
 }
 
+static void sanitize_string(char *s, char *new) {
+	size_t i,j, l = strlen(s), ls=l;
+	for(i=0,j=0;i<ls;i++) {
+		if(s[i] < ' ' || s[i] > 127) {
+			sprintf(new + j, "\\x%02x", s[i] & 0xff);
+			j  += 3;
+		} else new[j] = s[i];
+		j++;
+	}
+	new[j] = 0;
+}
+
+
 static void dump_wlan_at(unsigned wlanidx, unsigned line) {
 	console_goto(t, 0, line);
 	console_setcolor(t, 0, BGCOL);
@@ -588,9 +601,11 @@ static void dump_wlan_at(unsigned wlanidx, unsigned line) {
 
 	char macbuf[18];
 
-	if(*w->essid)
-		console_printf(t, "%*s", ESSID_PRINT_LEN, w->essid);
-	else
+	if(*w->essid) {
+		char essid_san[32*4+1];
+		sanitize_string(w->essid, essid_san);
+		console_printf(t, "%*s", ESSID_PRINT_LEN, essid_san);
+	} else
 		console_printf(t, "<hidden> %*s", ESSID_PRINT_LEN-9, mac2str(w->mac, macbuf));
 
 	console_goto(t, ESSID_PRINT_END +1, line);

programming_language: C