Unveiling Malicious Logic: Towards a Statement-Level Taxonomy and Dataset for Securing Python Packages

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Ryan, Ahmed, Ifti, Junaid Mansur, Erfan, Md, Rahman, Akond Ashfaque Ur, Rahman, Md Rayhanur
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912762496548864
author Ryan, Ahmed
Ifti, Junaid Mansur
Erfan, Md
Rahman, Akond Ashfaque Ur
Rahman, Md Rayhanur
author_facet Ryan, Ahmed
Ifti, Junaid Mansur
Erfan, Md
Rahman, Akond Ashfaque Ur
Rahman, Md Rayhanur
contents The widespread adoption of open-source ecosystems enables developers to integrate third-party packages, but also exposes them to malicious packages crafted to execute harmful behavior via public repositories such as PyPI. Existing datasets (e.g., pypi-malregistry, DataDog, OpenSSF, MalwareBench) label packages as malicious or benign at the package level, but do not specify which statements implement malicious behavior. This coarse granularity limits research and practice: models cannot be trained to localize malicious code, detectors cannot justify alerts with code-level evidence, and analysts cannot systematically study recurring malicious indicators or attack chains. To address this gap, we construct a statement-level dataset of 370 malicious Python packages (833 files, 90,527 lines) with 2,962 labeled occurrences of malicious indicators. From these annotations, we derive a fine-grained taxonomy of 47 malicious indicators across 7 types that capture how adversarial behavior is implemented in code, and we apply sequential pattern mining to uncover recurring indicator sequences that characterize common attack workflows. Our contribution enables explainable, behavior-centric detection and supports both semantic-aware model training and practical heuristics for strengthening software supply-chain defenses.
format Preprint
id arxiv_https___arxiv_org_abs_2512_12559
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Unveiling Malicious Logic: Towards a Statement-Level Taxonomy and Dataset for Securing Python Packages
Ryan, Ahmed
Ifti, Junaid Mansur
Erfan, Md
Rahman, Akond Ashfaque Ur
Rahman, Md Rayhanur
Cryptography and Security
The widespread adoption of open-source ecosystems enables developers to integrate third-party packages, but also exposes them to malicious packages crafted to execute harmful behavior via public repositories such as PyPI. Existing datasets (e.g., pypi-malregistry, DataDog, OpenSSF, MalwareBench) label packages as malicious or benign at the package level, but do not specify which statements implement malicious behavior. This coarse granularity limits research and practice: models cannot be trained to localize malicious code, detectors cannot justify alerts with code-level evidence, and analysts cannot systematically study recurring malicious indicators or attack chains. To address this gap, we construct a statement-level dataset of 370 malicious Python packages (833 files, 90,527 lines) with 2,962 labeled occurrences of malicious indicators. From these annotations, we derive a fine-grained taxonomy of 47 malicious indicators across 7 types that capture how adversarial behavior is implemented in code, and we apply sequential pattern mining to uncover recurring indicator sequences that characterize common attack workflows. Our contribution enables explainable, behavior-centric detection and supports both semantic-aware model training and practical heuristics for strengthening software supply-chain defenses.
title Unveiling Malicious Logic: Towards a Statement-Level Taxonomy and Dataset for Securing Python Packages
topic Cryptography and Security
url https://arxiv.org/abs/2512.12559