Skip to main content

Supply chain security scanner for Python projects

Project description

Seraph

Guardian of the supply chain.

Seraph is a Python supply chain security scanner. It detects attack vectors at the package level — before or after compromise — with no external dependencies and no network calls.

Python packages are a common supply chain attack surface. Known vectors include stolen publish tokens used to release malicious versions, payloads injected directly into package source files, persistence via .pth files executed automatically on interpreter startup, orphaned .pyc bytecode with no corresponding source, and backdoors installed post-execution with systemd persistence. Seraph detects these vectors at the package level.

What it detects

Scanner Detects
pth Executable code in .pth files (the 1.82.8 vector)
pyc Orphaned .pyc files and suspicious bytecode constants
source Obfuscated payload execution in .py files via AST analysis
integrity Post-install file tampering via dist-info RECORD hash verification
persistence Known backdoor artifacts on the filesystem

Installation

pip install schedy-seraph

Usage

# Run all scanners
seraph scan

# CI mode — exits with code 1 if findings are detected
seraph scan --ci

How it works

PTH scanner reads every .pth file in site-packages and flags lines containing executable patterns (import, exec(, base64, etc.). Legitimate .pth files contain only directory paths.

PYC scanner flags .pyc files with no corresponding .py source (injected bytecode) and walks the bytecode constant pool looking for Base64 blobs and exfiltration indicators.

Integrity scanner reads the RECORD file that pip writes at install time — which contains a SHA-256 hash of every installed file — and recomputes each hash. Any mismatch means the file was modified after installation.

Source scanner parses .py files in site-packages with Python's ast module and flags exec/eval calls wrapping decode or decompress operations — the pattern used to execute obfuscated payloads. AST analysis avoids false positives from comments and docstrings.

Persistence scanner checks for filesystem artifacts known to be dropped by the LiteLLM payload: the sysmon backdoor, systemd persistence service, and exfiltration remnants in /tmp.

Design

  • Zero dependencies — stdlib only
  • No network calls
  • Extensible: implement the Scanner protocol and register in cli.py
from seraph.base import Scanner, ScanResult

class MyScanner(Scanner):
    name = "my-scanner"
    description = "..."

    def run(self) -> ScanResult: ...

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schedy_seraph-0.1.4.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schedy_seraph-0.1.4-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file schedy_seraph-0.1.4.tar.gz.

File metadata

  • Download URL: schedy_seraph-0.1.4.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for schedy_seraph-0.1.4.tar.gz
Algorithm Hash digest
SHA256 09796ab9de8a24752816da4c79ce2385bd91666663f1deab1db27fc51351ce8f
MD5 c92f2e9c2dd9b9f798d668ed0e3ad5fc
BLAKE2b-256 cd262d43a08ae16dd732091150f3d451065efae2699d0875c4ade90592bc8ec4

See more details on using hashes here.

Provenance

The following attestation bundles were made for schedy_seraph-0.1.4.tar.gz:

Publisher: publish.yml on schedylabs/seraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file schedy_seraph-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: schedy_seraph-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for schedy_seraph-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 372ed7ba0dd6332cc3473446334e6c00a09727125cf3f1b998af9647e95ce26b
MD5 9364e5059e12b2ddd5daada7fb34bcb4
BLAKE2b-256 bffc664c97e3eef2898addbe10945dba588c9e0612c37c6e9755110010b1363b

See more details on using hashes here.

Provenance

The following attestation bundles were made for schedy_seraph-0.1.4-py3-none-any.whl:

Publisher: publish.yml on schedylabs/seraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page