Exploit databaseDownload repository ZIP
GH-2af8eacf03924d61b877104a3bad36c4
flags-alt/abyss-c2
Sources for CVE-2020-25078
14 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files39
flags-alt/abyss-c2Revision e53991d4aec1
- templates/
- .gitignore
- README.md
- auto_exploit.py
- botnet.py
- brute.py
- clean_db.py
- cred_spray.py
- database.py
- exploit.py
- inject_key.py
- inject_key2.py
- inject_key3.py
- inject_key4.py
- inject_ssh.py
- intel.py
- launch.py
- network_exploit.py
- persistence.py
- pivot_chain.py
- portscan.py
- proxy_rotation.py
- recon_asn.py
- recon_dns.py
- recon_geoip.py
- recon_jarm.py
- recon_waf.py
- requirements.txt
- reverse_shell.py
- scanner.py
- scheduler.py
- server.py
- socks_pivot.py
- stealth.py
- telnet_client.py
- web_brute.py
- web_bugs.py
- web_cves.py
- web_exploit.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
recon_jarm.py
Python · 9,827 bytes"""
JARM TLS fingerprinting — clean-room reimplementation of Salesforce's JARM.
Sends 10 specially-crafted ClientHellos and hashes the responses into a
62-character JARM fingerprint, used to identify TLS server stack/version.
Reference: https://github.com/salesforce/jarm (Apache 2.0)
"""
import socket
import struct
import os
import hashlib
import random as _rand
# 10 ClientHello "packet specs" used by JARM
JARM_PROBES = [
('TLS_1.2', 'ALL', 'FORWARD', 'NO_GREASE', 'APLN', '1.2_SUPPORT', 'REVERSE'),
('TLS_1.2', 'ALL', 'REVERSE', 'NO_GREASE', 'APLN', '1.2_SUPPORT', 'FORWARD'),
('TLS_1.2', 'ALL', 'TOP_HALF', 'NO_GREASE', 'APLN', 'NO_SUPPORT', 'FORWARD'),
('TLS_1.2', 'ALL', 'BOTTOM_HALF', 'NO_GREASE', 'RARE_APLN', 'NO_SUPPORT', 'FORWARD'),
('TLS_1.2', 'ALL', 'MIDDLE_OUT', 'GREASE', 'RARE_APLN', 'NO_SUPPORT', 'REVERSE'),
('TLS_1.1', 'ALL', 'FORWARD', 'NO_GREASE', 'APLN', 'NO_SUPPORT', 'FORWARD'),
('TLS_1.3', 'ALL', 'FORWARD', 'NO_GREASE', 'APLN', '1.3_SUPPORT', 'REVERSE'),
('TLS_1.3', 'ALL', 'REVERSE', 'NO_GREASE', 'APLN', '1.3_SUPPORT', 'FORWARD'),
('TLS_1.3', 'NO1.3', 'FORWARD', 'NO_GREASE', 'APLN', '1.3_SUPPORT', 'REVERSE'),
('TLS_1.3', 'ALL', 'MIDDLE_OUT', 'GREASE', 'APLN', '1.3_SUPPORT', 'REVERSE'),
]
# TLS cipher suites
CIPHER_LIST_ALL = [
b'\x00\x16', b'\x00\x33', b'\x00\x67', b'\xc0\x9e', b'\xc0\xa2',
b'\x00\x9e', b'\x00\x39', b'\x00\x6b', b'\xc0\x9f', b'\xc0\xa3',
b'\x00\x9f', b'\x00\x45', b'\x00\xbe', b'\x00\x88', b'\x00\xc4',
b'\x00\x9a', b'\xc0\x08', b'\xc0\x09', b'\xc0\x23', b'\xc0\xac',
b'\xc0\xae', b'\xc0\x2b', b'\xc0\x0a', b'\xc0\x24', b'\xc0\xad',
b'\xc0\xaf', b'\xc0\x2c', b'\xc0\x72', b'\xc0\x73', b'\xcc\xa9',
b'\x13\x02', b'\x13\x01', b'\xcc\x14', b'\xc0\x07', b'\xc0\x12',
b'\xc0\x13', b'\xc0\x27', b'\xc0\x2f', b'\xc0\x14', b'\xc0\x28',
b'\xc0\x30', b'\xc0\x60', b'\xc0\x61', b'\xc0\x76', b'\xc0\x77',
b'\xcc\xa8', b'\x13\x05', b'\x13\x04', b'\x13\x03', b'\xcc\x13',
b'\x00\x9c', b'\x00\x3c', b'\x00\x2f', b'\x00\xba', b'\x00\x41',
b'\x00\x9d', b'\x00\x3d', b'\x00\x35', b'\x00\x84', b'\x00\xc0',
b'\x00\x07', b'\x00\x04', b'\x00\x05',
]
CIPHER_LIST_NO13 = [c for c in CIPHER_LIST_ALL if c[0:1] != b'\x13']
GREASE_VALUES = [
b'\x0a\x0a', b'\x1a\x1a', b'\x2a\x2a', b'\x3a\x3a', b'\x4a\x4a',
b'\x5a\x5a', b'\x6a\x6a', b'\x7a\x7a', b'\x8a\x8a', b'\x9a\x9a',
b'\xaa\xaa', b'\xba\xba', b'\xca\xca', b'\xda\xda', b'\xea\xea', b'\xfa\xfa',
]
def _ciphers(spec):
if spec == 'NO1.3':
return list(CIPHER_LIST_NO13)
return list(CIPHER_LIST_ALL)
def _order_ciphers(c, mode):
if mode == 'REVERSE':
return list(reversed(c))
if mode == 'TOP_HALF':
if len(c) % 2 == 1:
return c[:len(c) // 2 + 1]
return c[:len(c) // 2]
if mode == 'BOTTOM_HALF':
return c[len(c) // 2:]
if mode == 'MIDDLE_OUT':
mid = len(c) // 2
out = []
if len(c) % 2 == 1:
out.append(c[mid])
for i in range(1, mid + 1):
out.append(c[mid + i])
out.append(c[mid - i])
else:
for i in range(1, mid + 1):
out.append(c[mid - 1 + i] if mid - 1 + i < len(c) else b'')
out.append(c[mid - i])
return [x for x in out if x]
return c
def _grease():
return _rand.choice(GREASE_VALUES)
def _ext_server_name(host):
sn = host.encode()
name_list = b'\x00' + struct.pack('!H', len(sn)) + sn
name_list = struct.pack('!H', len(name_list)) + name_list
return b'\x00\x00' + struct.pack('!H', len(name_list)) + name_list
def _ext_ec_point_formats():
return b'\x00\x0b\x00\x04\x03\x00\x01\x02'
def _ext_supported_groups():
groups = b'\x00\x1d\x00\x17\x00\x1e\x00\x18\x00\x19\x01\x00\x01\x01\x01\x02\x01\x03\x01\x04'
return b'\x00\x0a' + struct.pack('!H', len(groups) + 2) + struct.pack('!H', len(groups)) + groups
def _ext_session_ticket():
return b'\x00\x23\x00\x00'
def _ext_signature_algorithms():
sig = b'\x00\x01\x00\x02\x00\x03\x04\x01\x05\x01\x06\x01\x08\x07\x08\x08\x08\x09\x08\x0a\x08\x0b\x08\x04\x08\x05\x08\x06\x04\x03\x05\x03\x06\x03\x02\x01\x02\x03'
return b'\x00\x0d' + struct.pack('!H', len(sig) + 2) + struct.pack('!H', len(sig)) + sig
def _ext_alpn(rare=False):
if rare:
alpns = [b'\x08http/0.9', b'\x08http/1.0', b'\x06spdy/1', b'\x06spdy/2', b'\x06spdy/3',
b'\x03h2c', b'\x02hq']
else:
alpns = [b'\x08http/0.9', b'\x08http/1.0', b'\x08http/1.1', b'\x06spdy/1',
b'\x06spdy/2', b'\x06spdy/3', b'\x02h2', b'\x03h2c', b'\x02hq']
body = b''.join(alpns)
return b'\x00\x10' + struct.pack('!H', len(body) + 2) + struct.pack('!H', len(body)) + body
def _ext_key_share(grease=False):
pub = os.urandom(32)
share = b'\x00\x1d' + struct.pack('!H', 32) + pub
if grease:
share = _grease() + b'\x00\x01\x00' + share
return b'\x00\x33' + struct.pack('!H', len(share) + 2) + struct.pack('!H', len(share)) + share
def _ext_psk_modes():
return b'\x00\x2d\x00\x02\x01\x01'
def _ext_supported_versions(spec):
if spec == '1.2_SUPPORT':
versions = b'\x03\x03\x03\x02\x03\x01'
elif spec == '1.3_SUPPORT':
versions = b'\x03\x04\x03\x03\x03\x02\x03\x01'
else:
return b''
body = struct.pack('!B', len(versions)) + versions
return b'\x00\x2b' + struct.pack('!H', len(body)) + body
def _build_extensions(host, spec):
tls_ver, cipher_pick, cipher_order, grease_flag, alpn, sup_ver, ext_order = spec
ext = b''
parts = [
_ext_server_name(host),
_ext_ec_point_formats(),
_ext_supported_groups(),
_ext_session_ticket(),
_ext_signature_algorithms(),
_ext_alpn(rare=(alpn == 'RARE_APLN')),
_ext_key_share(grease=(grease_flag == 'GREASE')),
_ext_psk_modes(),
]
sv = _ext_supported_versions(sup_ver)
if sv:
parts.append(sv)
if ext_order == 'REVERSE':
parts = list(reversed(parts))
body = b''.join(parts)
return struct.pack('!H', len(body)) + body
def _build_client_hello(host, spec):
tls_ver, cipher_pick, cipher_order, grease_flag, _alpn, _sup, _ord = spec
ver_map = {'TLS_1.0': b'\x03\x01', 'TLS_1.1': b'\x03\x02',
'TLS_1.2': b'\x03\x03', 'TLS_1.3': b'\x03\x03'}
legacy_ver = ver_map.get(tls_ver, b'\x03\x03')
ciphers = _ciphers(cipher_pick)
ciphers = _order_ciphers(ciphers, cipher_order)
if grease_flag == 'GREASE':
ciphers = [_grease()] + ciphers
cipher_bytes = b''.join(ciphers)
rand = os.urandom(32)
sid = os.urandom(32)
sid_bytes = struct.pack('!B', len(sid)) + sid
hello = legacy_ver + rand + sid_bytes
hello += struct.pack('!H', len(cipher_bytes)) + cipher_bytes
hello += b'\x01\x00' # compression methods
hello += _build_extensions(host, spec)
handshake = b'\x01' + b'\x00' + struct.pack('!H', len(hello)) + hello
record = b'\x16' + legacy_ver + struct.pack('!H', len(handshake)) + handshake
return record
# ---------------- response parsing ----------------
def _parse_server_hello(buf):
"""Extract (cipher, ext_id_list_str) from a ServerHello record."""
if not buf or buf[0] != 0x16:
return ('|0|', '')
try:
# record header 5 bytes, handshake header 4 bytes
if len(buf) < 9 or buf[5] != 0x02:
return ('|0|', '')
# version (2) + random (32) -> 34 bytes after handshake header
idx = 9
idx += 2 # legacy version
idx += 32 # random
sid_len = buf[idx]; idx += 1 + sid_len
cipher = buf[idx:idx+2]; idx += 2
idx += 1 # compression
if idx + 2 > len(buf):
return (f'{cipher.hex()}|0|', '')
ext_total = struct.unpack('!H', buf[idx:idx+2])[0]; idx += 2
end = idx + ext_total
ext_ids = []
while idx + 4 <= end and idx + 4 <= len(buf):
eid = struct.unpack('!H', buf[idx:idx+2])[0]
elen = struct.unpack('!H', buf[idx+2:idx+4])[0]
ext_ids.append(f'{eid:04x}')
idx += 4 + elen
version = '0303'
return (f'{cipher.hex()}|{version}|', '-'.join(ext_ids))
except Exception:
return ('|0|', '')
def _send_probe(host, port, spec, timeout=4):
try:
s = socket.create_connection((host, port), timeout=timeout)
s.settimeout(timeout)
s.sendall(_build_client_hello(host, spec))
buf = s.recv(8192)
s.close()
return buf
except Exception:
return b''
def _jarm_hash(raw_fps):
"""Hash 10 raw fingerprints into 62-char JARM."""
if all(rf in ('|0|,', '|0|') for rf in raw_fps):
return '0' * 62
cipher_part = ''
ext_part = ''
for rf in raw_fps:
try:
ch, _ver, _ = (rf.split('|') + ['', ''])[:3]
except Exception:
ch = ''
cipher_part += (ch or '00') + '|'
raw_ext = ','.join(rf.split(',', 1)[1] if ',' in rf else '' for rf in raw_fps)
ext_hash = hashlib.sha256(raw_ext.encode()).hexdigest()[:32]
cipher_hex = hashlib.sha256(cipher_part.encode()).hexdigest()[:30]
return cipher_hex + ext_hash
def jarm_fingerprint(host, port=443, timeout=4):
"""Return 62-char JARM fingerprint for host:port"""
raw = []
for spec in JARM_PROBES:
buf = _send_probe(host, port, spec, timeout=timeout)
cipher_ver, ext_ids = _parse_server_hello(buf)
raw.append(f'{cipher_ver},{ext_ids}')
return _jarm_hash(raw)
if __name__ == '__main__':
import sys
h = sys.argv[1] if len(sys.argv) > 1 else 'cloudflare.com'
p = int(sys.argv[2]) if len(sys.argv) > 2 else 443
print(f'{h}:{p} -> {jarm_fingerprint(h, p)}')