Skip to main content

Find Linux privilege escalation paths by modeling permissions as a graph.

Project description

privmap

tests PyPI version Documentation License: MIT Python

Find Linux privilege escalation paths by modeling permissions as a graph.

privmap reads the live configuration of a Linux system: users, groups, sudo rules, file permissions, cron jobs, systemd units, capabilities, and running processes. It assembles them into a directed property graph, then traces concrete escalation paths from each non-privileged user to root and other high-value sinks.

[CRITICAL] 2 escalation paths found for user: www-data

Path 1: www-data -> root (4 hops)
  www-data
    MEMBER_OF  group: adm
    CAN_WRITE  file: /etc/logrotate.d/nginx  (mode: 0664)
    EXECUTES   cron: /etc/cron.daily  (runs-as: root)
  -> root

  Risk: Writable logrotate config executed by root daily cron
  Remediation: chmod 644 /etc/logrotate.d/nginx; chown root:root /etc/logrotate.d/nginx

Where flat-list scanners like LinPEAS report "this file is world-writable" and "this cron job runs as root" as separate observations, privmap connects them into the single chain that actually represents the escalation.

Install

pip install privmap

Requires Python 3.8 or later. From source: git clone … && pip install -e ..

Run

sudo privmap                                       # full scan, every user
sudo privmap --user www-data --user bob            # specific users
sudo privmap --min-severity high                   # filter by severity
sudo privmap --output json > report.json           # SIEM ingestion
sudo privmap --exit-code --min-severity critical   # CI/CD gate

For offline / forensic analysis, run the collector on the target and analyze the snapshot on your workstation:

sudo ./collect.sh                                                   # on target
privmap --snapshot ./privmap_snapshot_target_20260507.tar.gz        # on analyst host

The collector is POSIX-compliant and has no runtime dependencies on the target host.

Documentation

Full documentation lives at https://privmap.readthedocs.io/. Start with the quickstart, or jump straight to the graph model, CLI reference, scoring rules, CI/CD integration, or known limitations.

Scope

privmap is a structural analysis tool for local Linux privilege relationships. It does not perform network enumeration, run exploits, cover Windows or macOS, or match binary versions against a CVE database. Pair it with a vulnerability scanner for full coverage.

Use cases

  • System hardening. Validate least-privilege configurations and catch unintended escalation paths after changes.
  • Penetration testing. Replace manual enumeration with deterministic path mapping.
  • Incident response. Reconstruct how an attacker may have escalated privileges on a compromised host.
  • Education and CTF. Visualise permission chains that are hard to reason about manually.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING for development setup. For security vulnerabilities, see SECURITY.md.

License

MIT. See LICENSE.

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

privmap-1.0.5.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

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

privmap-1.0.5-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

File details

Details for the file privmap-1.0.5.tar.gz.

File metadata

  • Download URL: privmap-1.0.5.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for privmap-1.0.5.tar.gz
Algorithm Hash digest
SHA256 0cb678b72af2e358fa24f917def7a8e7141f34927c68726e5a1db92e972a7684
MD5 8b80c28157c87fdd94a84d133356a7cc
BLAKE2b-256 e0d51c507fbf812e9d9d6407e54910b0c1a678c47c039d4dd341f669aeaf1b9a

See more details on using hashes here.

File details

Details for the file privmap-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: privmap-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 41.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for privmap-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d3ee1b81d78a4671d731e7add05fcc972816b111039134f76e1aa4c1d00798eb
MD5 f6e0dd09c3d9b059d3df4cea6bc4b54f
BLAKE2b-256 5eabde9c7dcf32e866fe171aaa19d75fcba6f5e008a28bb8601b5b0246e510b2

See more details on using hashes here.

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