Skip to content

security: fix critical arbitrary code execution vectors#5648

Open
johnpippett wants to merge 1 commit intocrewAIInc:mainfrom
johnpippett:security/critical-fixes-2026-04-28
Open

security: fix critical arbitrary code execution vectors#5648
johnpippett wants to merge 1 commit intocrewAIInc:mainfrom
johnpippett:security/critical-fixes-2026-04-28

Conversation

@johnpippett
Copy link
Copy Markdown

Summary

Fixes two [Critical] security findings from the 2026-04-28 AI Tooling Security Audit:

  1. Arbitrary code execution via pickle deserialization (lib/crewai/src/crewai/utilities/file_handler.py:180)

    • Replaced pickle.load() / pickle.dump() with json.load() / json.dump() in PickleHandler.
    • Training data iteration keys are normalized to strings for JSON compatibility.
    • Removes the RCE surface entirely — JSON cannot execute arbitrary code during deserialization.
  2. Arbitrary code execution via tool cache_function dotted-path resolution (lib/crewai/src/crewai/tools/base_tool.py:69-73)

    • Changed _resolve_tool_dict to use string_to_callable() instead of calling _resolve_dotted_path() directly.
    • This enforces the existing CREWAI_DESERIALIZE_CALLBACKS environment-variable guard, which was previously bypassed during tool dict deserialization.

Files changed

  • lib/crewai/src/crewai/utilities/file_handler.py
  • lib/crewai/src/crewai/utilities/training_handler.py
  • lib/crewai/src/crewai/tools/base_tool.py
  • lib/crewai/src/crewai/agents/crew_agent_executor.py
  • lib/crewai/tests/utilities/test_file_handler.py
  • lib/crewai/tests/utilities/test_training_handler.py

Test results

All 73 tests in the affected test suites pass:

  • lib/crewai/tests/utilities/test_file_handler.py
  • lib/crewai/tests/utilities/test_training_handler.py
  • lib/crewai/tests/tools/test_base_tool.py
  • lib/crewai/tests/test_callback.py

- 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
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