security: fix critical arbitrary code execution vectors#5648
Open
johnpippett wants to merge 1 commit intocrewAIInc:mainfrom
Open
security: fix critical arbitrary code execution vectors#5648johnpippett wants to merge 1 commit intocrewAIInc:mainfrom
johnpippett wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
- Replace pickle with JSON in PickleHandler to eliminate deserialization RCE (lib/crewai/src/crewai/utilities/file_handler.py) - Enforce CREWAI_DESERIALIZE_CALLBACKS guard for cache_function dotted-path resolution in _resolve_tool_dict (lib/crewai/src/crewai/tools/base_tool.py) - Update training data iteration keys to strings for JSON compatibility - Update related tests for JSON serialization and env-var guard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two [Critical] security findings from the 2026-04-28 AI Tooling Security Audit:
Arbitrary code execution via pickle deserialization (
lib/crewai/src/crewai/utilities/file_handler.py:180)pickle.load()/pickle.dump()withjson.load()/json.dump()inPickleHandler.Arbitrary code execution via tool
cache_functiondotted-path resolution (lib/crewai/src/crewai/tools/base_tool.py:69-73)_resolve_tool_dictto usestring_to_callable()instead of calling_resolve_dotted_path()directly.CREWAI_DESERIALIZE_CALLBACKSenvironment-variable guard, which was previously bypassed during tool dict deserialization.Files changed
lib/crewai/src/crewai/utilities/file_handler.pylib/crewai/src/crewai/utilities/training_handler.pylib/crewai/src/crewai/tools/base_tool.pylib/crewai/src/crewai/agents/crew_agent_executor.pylib/crewai/tests/utilities/test_file_handler.pylib/crewai/tests/utilities/test_training_handler.pyTest results
All 73 tests in the affected test suites pass:
lib/crewai/tests/utilities/test_file_handler.pylib/crewai/tests/utilities/test_training_handler.pylib/crewai/tests/tools/test_base_tool.pylib/crewai/tests/test_callback.py