Skip to content

[Data] Fix RCE where attackers can execute arbitrary code with read_lance or nested pickle objects#64881

Open
bveeramani wants to merge 5 commits into
masterfrom
fix-lance-pickle-rce
Open

[Data] Fix RCE where attackers can execute arbitrary code with read_lance or nested pickle objects#64881
bveeramani wants to merge 5 commits into
masterfrom
fix-lance-pickle-rce

Conversation

@bveeramani

@bveeramani bveeramani commented Jul 20, 2026

Copy link
Copy Markdown
Member

Description

The Ray Data object extension type uses pickle to serialize and deserialize Python objects. When you read Parquet or Lance datasets from untrusted sources, attackers can execute arbitrary code when Ray Data unpickles objects.

I previously landed a PR to mitigate this issue for read_parquet by requiring users to opt-in to unpickling during reads.

In this PR, I'm making two related fixes:

  1. Making sure we also check for pickled objects in nested structures like lists
  2. Applying the opt-in guard to `read_lance

Related issues

Related to https://github.com/ray-project/ray/security/advisories/GHSA-whgc-7wqm-hx2r and https://github.com/ray-project/ray/security/advisories/GHSA-7h5h-hv6f-qjw9

Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
@bveeramani
bveeramani requested a review from a team as a code owner July 20, 2026 17:47

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request consolidates and strengthens the security guard against reading unsafe ray.data.arrow_pickled_object columns by introducing a centralized, recursive check (raise_on_pickle_object_columns) and applying it to both Parquet and Lance datasources. It also adds tests to ensure nested pickled-object columns are properly rejected. The review feedback highlights a critical security vulnerability in the recursive type-checking logic, where dictionary-encoded columns or custom extension types could bypass the guard, and provides a robust implementation to address this.

Comment thread python/ray/data/_internal/object_extensions/arrow.py Outdated
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
@bveeramani bveeramani changed the title [Data] Fix pickle object column deserialization RCE in read_lance and nested columns [Data] Fix RCE where attackers can execute arbitrary code with read_lance or nested pickle objects Jul 20, 2026
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Jul 20, 2026
Comment on lines +109 to +110
ext_type = ArrowPythonObjectType()
storage = pa.array([pickle.dumps(Exploit())], type=ext_type.storage_type)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Does it make sense to take these test setup steps (initializing ext_type, storage) out into a common shared helper for test_lance and test_parquet?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that'd be reasonable.

Since there are only two locations where those setups are used now, I'm going to accept some duplication to avoid indirection in those tests.

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants