secimport

eBPF Python runtime sandbox with seccomp (Blocks RCE).

MIT License

Downloads
429
Stars
180
Committers
3
secimport - v0.10.0 Latest Release

Published by avilum 5 months ago

  • Added dockerfile support for M3 silicon (Apple Macbooks)
  • Fixed utils bug that raised error if module name was empty (happens some times because of the way python modules are executed)
secimport - v0.9.2

Published by avilum 11 months ago

secimport - v0.9.1

Published by avilum over 1 year ago

  • Added nsjail support
  • Imroved CLI
  • Improved documentation
  • General bugfixes
secimport - v0.9.0

Published by avilum over 1 year ago

  • Added nsjail support
secimport - v0.8.2

Published by avilum over 1 year ago

secimport - v0.8.2-alpha

Published by avilum over 1 year ago

Added docker build and push to GH Actions

secimport - 0.8.1

Published by avilum over 1 year ago

Blocking the following insecure syscalls by deafult in secimport build:


INSECURE_SYSCALLS = [
    "vfork",
    "clone",
    "access",
    "chdir",
    "creat",
    "dup",
    "dup2",
    "execve",
    "faccessat",
    "fcntl",
    "fdatasync",
    "fork",
    "fstat",
    "fsync",
    "getegid",
    "geteuid",
    "getgid",
    "getgroups",
    "getpid",
    "getppid",
    "getrlimit",
    "getsockname",
    "getsid",
    "getuid",
    "ioctl",
    "link",
    "lseek",
    "lstat",
    "mkdir",
    "mknod",
    "open",
    "openat",
    "pipe",
    "poll",
    "read",
    "readlink",
    "readv",
    "recvfrom",
    "recvmsg",
    "rename",
    "rmdir",
    "select",
    "sendmsg",
    "sendto",
    "setgid",
    "setgroups",
    "setpgid",
    "setpriority",
    "setregid",
    "setreuid",
    "setrlimit",
    "setsid",
    "setsockopt",
    "stat",
    "symlink",
    "truncate",
    "umask",
    "utime",
    "utimes",
    "write",
    "writev",
]

secimport - 0.8.0

Published by avilum over 1 year ago

  • Added STOP and KILL flags
  • Improved documentation
  • Docker bugfixes
secimport - 0.7.3.2

Published by avilum over 1 year ago

  • Added github actions :)
secimport - 0.7.3

Published by avilum over 1 year ago

  • Added github actions build and push to pypi on merge to master branch
secimport - 0.7.2

Published by avilum over 1 year ago

secimport - 0.7.1

Published by avilum over 1 year ago

  • Added github deploy action
secimport - 0.7.0

Published by avilum over 1 year ago

  • Added Stop and Kill options
  • Added FastAPI example inside docker
  • Improved the CLI
  • Improved the README and overall documentation
  • Removed unused code / POC leftovers

The new usage I encourage is a follows:

pip install secimport==0.7.0

# Interactive quickstart
secimport interactive

FastAPI example

#!/bin/bash


echo "FastAPI Example"
echo "Tracing the main application, hit CTRL+C/CTRL+D when you are done."
/workspace/Python-3.10.0/python -m secimport.cli trace --entrypoint fastapi_main.py
/workspace/Python-3.10.0/python -m secimport.cli build
/workspace/Python-3.10.0/python -m secimport.cli run --entrypoint fastapi_main.py

Usage:

SecImport - A toolkit for Tracing and Securing Python Runtime using USDT probes and eBPF/DTrace: https://github.com/avilum/secimport/wiki/Command-Line-Usage

    QUICK START:
            >>> secimport interactive

    EXAMPLES:
        1. trace:
            $  secimport trace
            $  secimport trace -h
            $  secimport trace_pid 123
            $  secimport trace_pid -h
        2. build:
            # secimport build
            $ secimport build -h
        3. run:
            $  secimport run
            $  secimport run --entrypoint my_custom_main.py
            $  secimport run --entrypoint my_custom_main.py --stop_on_violation=true
            $  secimport run --entrypoint my_custom_main.py --kill_on_violation=true
            $  secimport run --sandbox_executable /path/to/my_sandbox.bt --pid 2884
            $  secimport run --sandbox_executable /path/to/my_sandbox.bt --sandbox_logfile my_log.log
            $  secimport run -h
secimport - 0.5.0

Published by avilum almost 2 years ago

  • Added bpftrace (ebpf) support
  • Added docker for bpftrace
  • Added tests
secimport - 0.4.3

Published by avilum about 2 years ago

  • Fixed unneeded imports that were not inside the dependencies list.
secimport - 0.4.2

Published by avilum about 2 years ago

Added pickle examples, improved logging and documentation

secimport - 0.4.1

Published by avilum about 2 years ago

  • Minor bugfixes in Paths prints
  • More docs
secimport - 0.4.0

Published by avilum about 2 years ago

Version 0.4.0 adds the ability to generate profile from a YAML template.
For a full usage documentation, visit https://github.com/avilum/secimport/blob/master/docs/YAML_PROFILES.md

secimport - 0.3.0

Published by avilum over 2 years ago

  • Added syscalls_allowlist argument that enables specifying specific syscalls only.
  • Improved examples
 module = secure_import(
            module_name="http",
            syscalls_allowlist="""
                                access
                                exit
                                getentropy
...

secimport - 0.2.0

Published by avilum over 2 years ago

Added optional dtrace flag for destructive mode.
When set to False (default is True), the process will be killed but only logged.
destructive (bool, optional): Whether to kill the process with -9 sigkill upon violation of any of the configurations above. Defaults to True