CVE-2026-44339: PraisonAI has unsafe tool resolution in `ToolExecutionMixin.execute_tool`: undeclared `__main__` callables execute
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, permallow 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 [toolexecution.py](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/toolexecution.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 getregistry registry = getregistry() func = registry.get(functionname) except ImportError: pass
if func is None: func = globals().get(functionname) if not func: import main func = getattr(main, functionname, None)
If a callable is found, it is executed directly:
python elif callable(func): castedarguments = self.castarguments(func, arguments) return func(castedarguments)
The permission gate does not enforce a declared-tool allowlist by default. In [toolexecution.py](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/praisonaiagents/agent/toolexecution.py:550), execution is only rejected if permallow is non-None:
python if self.permdeny and functionname in self.permdeny: return {"error": f"Tool '{functionname}' blocked by permission policy", "permissiondenied": True} if self.permallow is not None and functionname not in self.permallow: return {"error": f"Tool '{functionname}' not in allowed tools list", "permissiondenied": True}
Default agent initialization sets permallow = None, which means "allow all" rather than "allow only declared tools" in [agent.py](/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.permdeny = frozenset() # Permission tier deny set (empty = no denials) self.permallow = 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:
- [testpermissions.py](/Users/shmulc/Documents/Codex/2026-05-03/please-go-over-tmp-tp-advisories/repos/PraisonAI/src/praisonai-agents/tests/unit/testpermissions.py:56) asserts that a default Agent has permallow is None. - testpermissions.py explicitly checks that agent.checktoolapprovalsync("mycustomtool", {}) 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 executetool() 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: - praisonaiagents 1.6.35 - PraisonAI 4.6.35 - Python 3
Steps 1. 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.toolexecution import ToolExecutionMixin
def sneaky(msg='ok'): return {'ran': msg}
class HookRunner: def executesync(self, args, kwargs): return [] def isblocked(self, results): return False
class Dummy(ToolExecutionMixin): def init(self): self.name = 'demo' self.tools = [] self.chathistory = [] self.hookrunner = HookRunner() self.contextmanager = None self.doomlooptracker = None self.permdeny = frozenset() self.permallow = None self.approvalbackend = None
mockregistry = MagicMock() mockregistry.approvesync.returnvalue = MagicMock(approved=True, reason='mock', modifiedargs=None) mockregistry.markapproved = MagicMock()
with patch('praisonaiagents.approval.getapprovalregistry', returnvalue=mockregistry): agent = Dummy() print(agent.executetool('sneaky', {'msg': 'hello'})) print(mockregistry.approvesync.callargs) PY
Expected 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() and main. - 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.
Other sources
PraisonAI is a multi-agent teams system. Prior to praisonai version 4.6.37 and praisonaiagents version 1.6.37, 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, permallow 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. This issue has been patched in praisonai version 4.6.37 and praisonaiagents version 1.6.37.
— NVD
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-44339?
CVE-2026-44339 is classified as a critical vulnerability due to the potential for arbitrary code execution.
How do I fix CVE-2026-44339?
To fix CVE-2026-44339, upgrade to PraisonAI version 4.6.37 or higher and PraisonAI agents version 1.6.37 or higher.
Who is affected by CVE-2026-44339?
CVE-2026-44339 affects users of PraisonAI versions prior to 4.6.37 and PraisonAI agents versions prior to 1.6.37.
What type of application is affected by CVE-2026-44339?
CVE-2026-44339 affects the PraisonAI multi-agent teams system.
What is the main issue with CVE-2026-44339?
The main issue with CVE-2026-44339 is unsafe tool resolution where undeclared __main__ callables can be executed.