Skip to content

security: validate network inputs before building shell/AT commands#3290

Open
geraldo-netto wants to merge 3 commits into
blueman-project:mainfrom
geraldo-netto:security/input-validation
Open

security: validate network inputs before building shell/AT commands#3290
geraldo-netto wants to merge 3 commits into
blueman-project:mainfrom
geraldo-netto:security/input-validation

Conversation

@geraldo-netto

Copy link
Copy Markdown

Harden three places where externally-influenced values were interpolated into command arguments without validation:

  • NetConf: validate that the IPv4 address and netmask passed to apply_settings are plain IPv4 addresses before they reach ip/ifconfig/iptables, and build iptables rules from already-split argument lists instead of splitting a single string on spaces. A value containing a space can no longer inject extra iptables arguments.
  • Rfcomm: the CloseRFCOMM handler parsed ps output with an unguarded split()/int(), so a malformed or unexpected line raised ValueError and aborted the mechanism. Skip rows that lack a numeric pid and a command.
  • PPPConnection: validate the APN against the 3GPP label charset before embedding it in the quoted AT+CGDCONT command, preventing break-out of the quoted argument.

Add unit + fuzz coverage for each: IPv4 validation (valid/invalid/injection), iptables argument construction (no splitting, delete symmetry), ps-output parsing across malformed inputs, and APN acceptance/rejection with fuzzed payloads. Tests need no D-Bus or display.

Harden three places where externally-influenced values were interpolated into
command arguments without validation:

- NetConf: validate that the IPv4 address and netmask passed to apply_settings
  are plain IPv4 addresses before they reach ip/ifconfig/iptables, and build
  iptables rules from already-split argument lists instead of splitting a
  single string on spaces. A value containing a space can no longer inject
  extra iptables arguments.
- Rfcomm: the CloseRFCOMM handler parsed `ps` output with an unguarded
  split()/int(), so a malformed or unexpected line raised ValueError and
  aborted the mechanism. Skip rows that lack a numeric pid and a command.
- PPPConnection: validate the APN against the 3GPP label charset before
  embedding it in the quoted AT+CGDCONT command, preventing break-out of the
  quoted argument.

Add unit + fuzz coverage for each: IPv4 validation (valid/invalid/injection),
iptables argument construction (no splitting, delete symmetry), ps-output
parsing across malformed inputs, and APN acceptance/rejection with fuzzed
payloads. Tests need no D-Bus or display.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread blueman/main/PPPConnection.py Outdated
@sonarqubecloud

sonarqubecloud Bot commented Jun 3, 2026

Copy link
Copy Markdown

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