Skip to content

Security: Command injection risk in privileged shell command construction#458

Closed
tomaioo wants to merge 1 commit intobrechtm:masterfrom
tomaioo:fix/security/command-injection-risk-in-privileged-she
Closed

Security: Command injection risk in privileged shell command construction#458
tomaioo wants to merge 1 commit intobrechtm:masterfrom
tomaioo:fix/security/command-injection-risk-in-privileged-she

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented Apr 12, 2026

Summary

Security: Command injection risk in privileged shell command construction

Problem

Severity: High | File: macapp/src/rinoh_macapp/app.py:L29

The macOS helper builds a shell command string (create_link) using .format() and then executes it via AppleScript do shell script ... with administrator privileges. Because arguments are interpolated into a single shell string without robust escaping/quoting, a path containing shell metacharacters (for example, a crafted app install path with quotes or ;) could alter the command executed as admin.

Solution

Avoid building a shell command string. Execute privileged operations with argument-safe APIs (e.g., a dedicated helper binary/script invoked with fixed argv), or strictly shell-escape each value with shlex.quote() before interpolation. Also validate that rinoh_path and link_path contain only expected characters.

Changes

  • macapp/src/rinoh_macapp/app.py (modified)

The macOS helper builds a shell command string (`create_link`) using `.format()` and then executes it via AppleScript `do shell script ... with administrator privileges`. Because arguments are interpolated into a single shell string without robust escaping/quoting, a path containing shell metacharacters (for example, a crafted app install path with quotes or `;`) could alter the command executed as admin.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@brechtm
Copy link
Copy Markdown
Owner

brechtm commented Apr 12, 2026

Closing: PR submitted by AI bot not reviewed by their owner.

@brechtm brechtm closed this Apr 12, 2026
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.

3 participants