Skip to content

Insecure Deserialization via pickle.load in Im2LatexDataset.load Leads to Arbitrary Code Execution #441

Description

@Doria77486

Description

The Im2LatexDataset.load method deserializes dataset files using Python’s pickle.load without any validation or trust boundary checks:

    def load(self, filename, args=[]):
        if not os.path.exists(filename):
            with in_model_path():
                tempf = os.path.join('..', filename)
                if os.path.exists(tempf):
                    filename = os.path.realpath(tempf)
        with open(filename, 'rb') as file:
            x = pickle.load(file)
        return x

When users load a dataset through this class, attacker-controlled pickle files can be deserialized directly. Since pickle is not safe for untrusted input, this behavior introduces a deserialization vulnerability that may lead to arbitrary code execution (RCE).
Any user who loads a dataset from an untrusted or tampered source (e.g., downloaded datasets, shared files, third-party repositories) is affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions