https://github.com/crowdstrike/pymalevasion

Code for the paper "PyMalEvasion: Generative AI-based Adversarial Evasion in Python Scripts"

https://github.com/crowdstrike/pymalevasion

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary
Last synced: 7 months ago · JSON representation

Repository

Code for the paper "PyMalEvasion: Generative AI-based Adversarial Evasion in Python Scripts"

Basic Info
  • Host: GitHub
  • Owner: CrowdStrike
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 34.2 KB
Statistics
  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 11 months ago · Last pushed 11 months ago
Metadata Files
Readme Contributing License Code of conduct Security

README.md

CrowdStrike FalconPy CrowdStrike FalconPy

PyMalEvasion: Generative AI-based Adversarial Evasion in Python Scripts

Data is available at DOI

Dataset

| Name | Type | Clean | Dirty | Total | | --- | --- | --- | --- | --- | | Ours (train) | Script | 15,242 | 11,456 | 26,698 | | Ours (valid) | Script | 1,075 | 2,046 | 3,121 | | Ours (test) | Script | 603 | 1,760 | 2,363 | | Ours (all) | Script | 16,920 | 15,262 | 32,182 | | Ours (adv_test) | Script | 0 | 5,332 | 5,332 |

The PyMalEvasion dataset is constructed by augmenting the PyPI Malregistry dataset with samples from VT. You can use this script to extract the sources from the archived PyPI Malregistry. After extracting the sources, we filtered out those under 512 bytes (e.g. containing typically harmless initialization or configuration scripts).

We further split the data into train/valid/test following a cluster-informed method. We apply the shallow FX, UMAP for dimensionality reduction and HDBSCAN for the actual clustering. Finally, the splits are chosen such that all samples in a cluster are from a single split, thus minimizing potential information leakage.

Adversarial generation

  • Heuristics (simple modifications to add comments, documentation, padding)
  • LLM constrained via AST and RAG
  • LLM unconstrained

For AST-based constrained generation, the LLM is instructed to generate an action (add/edit/delete) and a code snippet for which the action to take place. Then, the AST of the original script is updated from the (smaller) AST of the snippet.

Classifiers

We employ 3 classification strategies: shallow (XGBoost on handcrafted features), CodeBERT (adapted from microsoft/CodeBERT, base model: microsoft/codebert-base) and LLM-based.

For the shallow classification we built 8 feature types and trained an XGBoost model for each one of the 255 feature combinations. Models are trained with HPO and 5-fold cross-validation.

Support statement

PyMalEvasion is an open source project, not a CrowdStrike product. As such, it carries no formal support, expressed or implied.

Owner

  • Name: CrowdStrike
  • Login: CrowdStrike
  • Kind: organization
  • Email: github@crowdstrike.com
  • Location: United States of America

GitHub Events

Total
  • Watch event: 2
  • Public event: 1
  • Push event: 1
Last Year
  • Watch event: 2
  • Public event: 1
  • Push event: 1

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 1
  • Total Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Alexandru Dinu a****u@c****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

environment.yml pypi
requirements.txt pypi
  • Deprecated ==1.2.18
  • Jinja2 ==3.1.6
  • MarkupSafe ==3.0.2
  • PyYAML ==6.0.2
  • Pygments ==2.19.1
  • aiohappyeyeballs ==2.6.1
  • aiohttp ==3.11.18
  • aiosignal ==1.3.2
  • airportsdata ==20250224
  • annotated-types ==0.7.0
  • anthropic ==0.51.0
  • anyio ==4.9.0
  • ast_comments *
  • astor ==0.8.1
  • async-timeout ==5.0.1
  • attrs ==25.3.0
  • black *
  • blake3 ==1.0.4
  • boto3 *
  • bs4 *
  • cachetools ==5.5.2
  • certifi ==2025.4.26
  • charset-normalizer ==3.4.2
  • click ==8.2.0
  • cloudpickle ==3.1.1
  • compressed-tensors ==0.9.3
  • cupy-cuda12x ==13.4.1
  • depyf ==0.18.0
  • dill ==0.4.0
  • diskcache ==5.6.3
  • distro ==1.9.0
  • dnspython ==2.7.0
  • einops ==0.8.1
  • email_validator ==2.2.0
  • exceptiongroup ==1.3.0
  • fastapi ==0.115.12
  • fastapi-cli ==0.0.7
  • fastrlock ==0.8.3
  • filelock ==3.18.0
  • frozenlist ==1.6.0
  • fsspec ==2025.3.2
  • gguf ==0.16.3
  • googleapis-common-protos ==1.70.0
  • grpcio ==1.71.0
  • h11 ==0.16.0
  • hdbscan *
  • hf-xet ==1.1.0
  • hiplot *
  • httpcore ==1.0.9
  • httptools ==0.6.4
  • httpx ==0.28.1
  • huggingface-hub ==0.31.1
  • idna ==3.10
  • importlib_metadata ==8.0.0
  • interegular ==0.3.3
  • jiter ==0.9.0
  • jsonschema ==4.23.0
  • jsonschema-specifications ==2025.4.1
  • lark ==1.2.2
  • llguidance ==0.7.19
  • llvmlite ==0.44.0
  • lm-format-enforcer ==0.10.11
  • loguru *
  • markdown-it-py ==3.0.0
  • matplotlib *
  • mdurl ==0.1.2
  • mistral_common ==1.5.4
  • mpmath ==1.3.0
  • msgpack ==1.1.0
  • msgspec ==0.19.0
  • multidict ==6.4.3
  • nest-asyncio ==1.6.0
  • networkx ==3.4.2
  • ninja ==1.11.1.4
  • numba ==0.61.2
  • numpy ==2.2.5
  • nvidia-cublas-cu12 ==12.4.5.8
  • nvidia-cuda-cupti-cu12 ==12.4.127
  • nvidia-cuda-nvrtc-cu12 ==12.4.127
  • nvidia-cuda-runtime-cu12 ==12.4.127
  • nvidia-cudnn-cu12 ==9.1.0.70
  • nvidia-cufft-cu12 ==11.2.1.3
  • nvidia-curand-cu12 ==10.3.5.147
  • nvidia-cusolver-cu12 ==11.6.1.9
  • nvidia-cusparse-cu12 ==12.3.1.170
  • nvidia-cusparselt-cu12 ==0.6.2
  • nvidia-nccl-cu12 ==2.21.5
  • nvidia-nvjitlink-cu12 ==12.4.127
  • nvidia-nvtx-cu12 ==12.4.127
  • openai ==1.78.1
  • opencv-python-headless ==4.11.0.86
  • openpyxl *
  • opentelemetry-api ==1.26.0
  • opentelemetry-exporter-otlp ==1.26.0
  • opentelemetry-exporter-otlp-proto-common ==1.26.0
  • opentelemetry-exporter-otlp-proto-grpc ==1.26.0
  • opentelemetry-exporter-otlp-proto-http ==1.26.0
  • opentelemetry-proto ==1.26.0
  • opentelemetry-sdk ==1.26.0
  • opentelemetry-semantic-conventions ==0.47b0
  • opentelemetry-semantic-conventions-ai ==0.4.8
  • outlines ==0.1.11
  • outlines_core ==0.1.26
  • packaging ==25.0
  • pandas >=2.0.0
  • partial-json-parser ==0.2.1.1.post5
  • pillow ==11.2.1
  • plotly *
  • prometheus-fastapi-instrumentator ==7.1.0
  • prometheus_client ==0.21.1
  • propcache ==0.3.1
  • protobuf ==4.25.7
  • psutil ==7.0.0
  • py-cpuinfo ==9.0.0
  • pyarrow *
  • pycountry ==24.6.1
  • pydantic ==2.11.4
  • pydantic_core ==2.33.2
  • python-dotenv ==1.1.0
  • python-json-logger ==3.3.0
  • python-multipart ==0.0.20
  • pyzmq ==26.4.0
  • radon ==6.0.1
  • ray ==2.46.0
  • referencing ==0.36.2
  • regex ==2024.11.6
  • requests ==2.32.3
  • rich ==14.0.0
  • rich-toolkit ==0.14.5
  • rpds-py ==0.24.0
  • safetensors ==0.5.3
  • scikit-learn *
  • scipy ==1.15.3
  • seaborn *
  • sentencepiece ==0.2.0
  • shellingham ==1.5.4
  • sniffio ==1.3.1
  • starlette ==0.46.2
  • sympy ==1.13.1
  • tiktoken ==0.9.0
  • tokenizers ==0.21.1
  • torch ==2.6.0
  • torchaudio ==2.6.0
  • torchvision ==0.21.0
  • tqdm ==4.67.1
  • transformers ==4.51.3
  • triton ==3.2.0
  • typer ==0.15.3
  • typing-inspection ==0.4.0
  • typing_extensions ==4.13.2
  • umap-learn *
  • urllib3 ==2.4.0
  • uvicorn ==0.34.2
  • uvloop ==0.21.0
  • validators *
  • vllm ==0.8.5.post1
  • watchfiles ==1.0.5
  • websockets ==15.0.1
  • wrapt ==1.17.2
  • xformers ==0.0.29.post2
  • xgboost ==2.0.3
  • xgrammar ==0.1.18
  • yarl ==1.20.0
  • zipp ==3.21.0