Security: Unsafe deserialization of pickle log files#724
Closed
qdzsh wants to merge 1 commit into
Closed
Conversation
FileLogger.load_logs() deserializes entries from a .pkl file using pickle.load(). Pickle is not safe for untrusted or tampered data and can execute arbitrary code during deserialization. If an attacker can write or replace the pickle log file, loading logs can lead to code execution in the caller's process. Affected files: logging.py Signed-off-by: Quang Do <github@qdzsh.dev>
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
Security: Unsafe deserialization of pickle log files
Problem
Severity:
High| File:src/art/langgraph/logging.py:L23FileLogger.load_logs() deserializes entries from a .pkl file using pickle.load(). Pickle is not safe for untrusted or tampered data and can execute arbitrary code during deserialization. If an attacker can write or replace the pickle log file, loading logs can lead to code execution in the caller's process.
Solution
Avoid pickle for log storage. Use a safe format such as JSON Lines, msgpack without object hooks, or another data-only serialization format. If backwards compatibility is required, only load pickle files from trusted locations with strict file permissions and clearly document that they must never be opened from untrusted sources.
Changes
src/art/langgraph/logging.py(modified)Testing
Generated by ContribAI v6.8.0