GithubHelp home page GithubHelp logo

ssst0n3 / ctrsploit_archived Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 5.36 MB

Move to https://github.com/ctrsploit/ctrsploit

Go 91.27% Dockerfile 3.99% C 0.64% Python 3.68% Shell 0.42%
docker container penetration-testing-tools

ctrsploit_archived's Introduction

ctrsploit: A penetration toolkit for container environment

中文文档

Pre-Built Release

https://github.com/ssst0n3/ctrsploit/releases

Usage

Quick-Start

wget -O ctrsploit https://github.com/ssst0n3/ctrsploit/releases/download/v0.4/ctrsploit_linux_amd64 && chmod +x ctrsploit
./ctrsploit --help
NAME:
   ctrsploit - A penetration toolkit for container environment

ctrsploit is a command line ... //TODO


USAGE:
   ctrsploit [global options] command [command options] [arguments...]

COMMANDS:
   auto, a     auto gathering information, and detect vuls, and exploit // TODO
   exploit, e  run a exploit
   env, e      gather information // TODO
   help, h     Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --lang value  language for the greeting (default: "english")
   --help, -h    show help (default: false)

gather information

usage

root@ctr:/# ./ctrsploit env
NAME:
   ctrsploit env - gather information

USAGE:
   ctrsploit env command [command options] [arguments...]

COMMANDS:
   where, w        detect whether you are in the container, and which type of the container
   graphdriver, g  detect graphdriver type and extend information
   cgroups, c      gather cgroup information
   help, h         Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help (default: false)

where

root@ctr:/# ./ctrsploit  env  w
INFO[0000] ===========Docker=========
.dockerenv exists: ✔
rootfs contains 'docker': ✔
cgroup contains 'docker': ✘
the mount source of /etc/hosts contains 'docker': ✔
hostname match regex ^[0-9a-f]{12}$: ✔
=> is in docker: ✔ 
INFO[0000] ===========k8s=========
/var/run/secrets/kubernetes.io exists: ✘
hostname match k8s pattern: ✘
the mount source of /etc/hosts contains 'pods': ✘
cgroup contains 'kubepods': ✘
=> is in k8s: ✘ 

run a exploit

root@2aa13a052102:/# ./ctrsploit e
NAME:
   ctrsploit exploit - run a exploit

USAGE:
   ctrsploit exploit command [command options] [arguments...]

COMMANDS:
   cgroupv1-release_agent, ra                       escape tech by using the notify_on_release of cgroup v1
   cgroupv1-release_agent-unknown_rootfs, ra3       escape tech by using the notify_on_release of cgroup v1 without known rootfs
   help, h                                          Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help (default: false)

eg. : escape by 'cgroupv1-release_agent' tech.

root@host # docker run -ti --rm --security-opt="apparmor=unconfined" --cap-add="sys_admin" busybox
root@ctr # wget -O ctrsploit https://github.com/ssst0n3/ctrsploit/releases/download/v0.4/ctrsploit_linux_amd64 && chmod +x ctrsploit
root@ctr # ./ctrsploit e ra -c "cat /etc/hostname"

Details

env

command alias description
where w detect whether you are in the container, and which type of the container
graphdriver g detect graphdriver type and extend information
cgroups c gather cgroup information
capability cap show the capability of pid 1 and current process
seccomp s show the seccomp info
apparmor a show the apparmor info

exploit

exploit alias description
cgroupv1-release_agent ra escape tech by using the notify_on_release of cgroup v1
cgroupv1-release_agent-unknown_rootfs ra3 escape tech by using the notify_on_release of cgroup v1 without known rootfs
cve-2021-22555 22555 escape tech by using the CVE-2021-22555

Todo List

see FEATURES.md

ctrsploit_archived's People

Contributors

ssst0n3 avatar

Stargazers

kepler404 avatar  avatar 白马寺 avatar Bonan avatar Burden Haze  avatar Mauro Risonho de Paula Assumpção avatar Moya Lee avatar

Watchers

 avatar

ctrsploit_archived's Issues

Add option for capability to decide whether show current process's capablity

Current:

# ./ctrsploit env cap
INFO[0000] ===========Capability=========
pid 1
[caps]
0x3fffffffff != default(0xa80425fb)

[parsed]
[CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID CAP_KILL CAP_SETGID CAP_SETUID CAP_SETPCAP CAP_LINUX_IMMUTABLE CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_ADMIN CAP_NET_RAW CAP_IPC_LOCK CAP_IPC_OWNER CAP_SYS_MODULE CAP_SYS_RAWIO CAP_SYS_CHROOT CAP_SYS_PTRACE CAP_SYS_PACCT CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_NICE CAP_SYS_RESOURCE CAP_SYS_TIME CAP_SYS_TTY_CONFIG CAP_MKNOD CAP_LEASE CAP_AUDIT_WRITE CAP_AUDIT_CONTROL CAP_SETFCAP CAP_MAC_OVERRIDE CAP_MAC_ADMIN CAP_SYSLOG CAP_WAKE_ALARM CAP_BLOCK_SUSPEND CAP_AUDIT_READ]

[Additional Capabilities]
["CAP_DAC_READ_SEARCH" "CAP_LINUX_IMMUTABLE" "CAP_NET_BROADCAST" "CAP_NET_ADMIN" "CAP_IPC_LOCK" "CAP_IPC_OWNER" "CAP_SYS_MODULE" "CAP_SYS_RAWIO" "CAP_SYS_PTRACE" "CAP_SYS_PACCT" "CAP_SYS_ADMIN" "CAP_SYS_BOOT" "CAP_SYS_NICE" "CAP_SYS_RESOURCE" "CAP_SYS_TIME" "CAP_SYS_TTY_CONFIG" "CAP_LEASE" "CAP_AUDIT_CONTROL" "CAP_MAC_OVERRIDE" "CAP_MAC_ADMIN" "CAP_SYSLOG" "CAP_WAKE_ALARM" "CAP_BLOCK_SUSPEND" "CAP_AUDIT_READ"]

current process
[caps]
0x3fffffffff != default(0xa80425fb)

[parsed]
[CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID CAP_KILL CAP_SETGID CAP_SETUID CAP_SETPCAP CAP_LINUX_IMMUTABLE CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_ADMIN CAP_NET_RAW CAP_IPC_LOCK CAP_IPC_OWNER CAP_SYS_MODULE CAP_SYS_RAWIO CAP_SYS_CHROOT CAP_SYS_PTRACE CAP_SYS_PACCT CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_NICE CAP_SYS_RESOURCE CAP_SYS_TIME CAP_SYS_TTY_CONFIG CAP_MKNOD CAP_LEASE CAP_AUDIT_WRITE CAP_AUDIT_CONTROL CAP_SETFCAP CAP_MAC_OVERRIDE CAP_MAC_ADMIN CAP_SYSLOG CAP_WAKE_ALARM CAP_BLOCK_SUSPEND CAP_AUDIT_READ]

[Additional Capabilities]
["CAP_DAC_READ_SEARCH" "CAP_LINUX_IMMUTABLE" "CAP_NET_BROADCAST" "CAP_NET_ADMIN" "CAP_IPC_LOCK" "CAP_IPC_OWNER" "CAP_SYS_MODULE" "CAP_SYS_RAWIO" "CAP_SYS_PTRACE" "CAP_SYS_PACCT" "CAP_SYS_ADMIN" "CAP_SYS_BOOT" "CAP_SYS_NICE" "CAP_SYS_RESOURCE" "CAP_SYS_TIME" "CAP_SYS_TTY_CONFIG" "CAP_LEASE" "CAP_AUDIT_CONTROL" "CAP_MAC_OVERRIDE" "CAP_MAC_ADMIN" "CAP_SYSLOG" "CAP_WAKE_ALARM" "CAP_BLOCK_SUSPEND" "CAP_AUDIT_READ"]

There's some redundant info.

Add an option like --current to show current process for capability subcommand may be better.

Improving file structure

There are some directories that are not required, because there only single file under that directory such as env/apparmor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.