Skip to content

Parse quoted SSIDs and vendor names in scan CSV - #3

Merged
elpadrino26 merged 1 commit into
developmentfrom
cursor/scan-csv-quoted-fields-0f59
Oct 29, 2026
Merged

elpadrino26 merged 1 commit into
developmentfrom
cursor/scan-csv-quoted-fields-0f59

Conversation

@elpadrino26

Copy link
Copy Markdown

Summary

scan_networks / show_scan_results rows are RFC 4180 CSV:

"index","SSID","vendor","BSSID","channel","auth","RSSI","band"

A " inside a field is written as "". csv_next_quoted_field used to end the field at the first quote, so parse_network_line rejected the row and the network never appeared.

The reader now turns each "" into one ", keeps reading until the real closing quote, and still refuses to write past the output buffer. Plain quoted fields (no inner quotes) are unchanged. Commas inside a quoted SSID or vendor stay in that field.

The only parser of these eight-column lines is the UART scan worker. It stores the unescaped SSID, vendor, BSSID, channel, auth, RSSI, and band. Network info (Left on a scan row) draws:

  • SSID moja "specjalna" siec (no prefix, so the 21-character name fits one row)
  • Vendor: Acme "X" Inc
  • BSSID, Ch: 6 2.4GHz -50 dBm, and auth

The scan list uses the same unescaped SSID. Evil-twin password and portal-data screens share csv_next_quoted_field, so those quoted fields unescape too.

Wardrive ,WIFI lines are a different CSV and were left alone.

Test

python3 tests/test_scan_csv.py builds src/scan_csv.c on the host (no Flipper SDK). It checks the firmware example, a plain row, commas plus quotes, truncation that must not shift later columns, buffer bounds, and rejected rows.

SSID sent back to the firmware

Commands that send a selected SSID do not escape " (or spaces, when the SSID is unquoted). Not changed here: the command parser is separate from the scan-line writer, and doubling quotes in the command would be wrong if that parser does not unescape.

Quoted form wifi_connect "<ssid>" "<password>" (a " in the SSID closes the argument early):

  • src/screen_arp_poisoning.c
  • src/screen_mitm_pcap.c
  • src/screen_nmap.c
  • src/screen_wpasec.c
  • src/screen_arp_from_creds.c (SSID comes from the evil-twin list, which now unescapes)

Unquoted form (spaces, commas, and quotes all split the command):

  • src/screen_wardrive_upload.c — wifi_connect %s %s
  • src/screen_rogue_ap.c — start_rogueap %s %s

Same hole for typed names, not scan selection: start_portal "%s" in src/screen_portal.c, add_ssid "%s" in src/screen_beacon_spam.c.

select_networks sends the list index, not the SSID.

show_pass evil matchers still stop at the first " and will not match an unescaped SSID that contains a quote: arp_check_password, mitm_check_password, nmap_check_password, rogue_ap_check_password, wpasec_check_password, wdup_check_evil_password.

Open in Web Open in Cursor 

The scan line reader ended a field at the first quotation mark, so an
SSID or vendor containing a quote was dropped. Unescape doubled quotes
into bounded buffers and show that text on the network info screen.

Co-authored-by: El Padrino <elpadrino26@users.noreply.github.com>
@elpadrino26
elpadrino26 merged commit bccbb36 into development Oct 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants