Skip to content

fix(security): harden shell tool and remove dangerous defaults#1519

Open
SH20RAJ wants to merge 1 commit intomofa-org:mainfrom
SH20RAJ:fix/shell-security-801
Open

fix(security): harden shell tool and remove dangerous defaults#1519
SH20RAJ wants to merge 1 commit intomofa-org:mainfrom
SH20RAJ:fix/shell-security-801

Conversation

@SH20RAJ
Copy link
Copy Markdown
Contributor

@SH20RAJ SH20RAJ commented Mar 28, 2026

This pull request addresses several critical security vulnerabilities in the ShellCommandTool as part of issue #801.

Key Changes

  1. Harden Default Command Whitelist: Removed potentially dangerous commands (cat, find) from the default permitted list in ShellCommandTool::new_with_defaults(). These commands can be used to bypass sandbox restrictions and read sensitive files.
  2. Argument Validation: Implemented a new has_dangerous_args check that identifies shell operators (e.g., |, >, <, ;, &, $, `) in command arguments.
  3. Prevention of Command Injection: The executor now explicitly rejects execution tasks if any dangerous patterns are detected in the arguments, preventing attackers from chaining commands or redirecting output to unauthorized files.

These enhancements significantly improve the MoFA plugin's security posture and ensure that shell interactions remain strictly within their intended boundaries.

Addresses #801.

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.

1 participant