dizqueTV 1.5.3 - Remote Code Execution (RCE)

Exploit Author: Ahmed Said Saud Al-Busaidi Analysis Author: www.bubbleslearn.ir Category: WebApps Language: JavaScript Published Date: 2024-10-01
# Exploit Title: dizqueTV 1.5.3 - Remote Code Execution (RCE)
# Date: 9/21/2024
# Exploit Author: Ahmed Said Saud Al-Busaidi
# Vendor Homepage: https://github.com/vexorian/dizquetv
# Version: 1.5.3
# Tested on: linux

POC:

## Vulnerability Description

dizqueTV 1.5.3 is vulnerable to unauthorized remote code execution from attackers.

## STEPS TO REPRODUCE

1. go to http://localhost/#!/settings 

2. now go to ffmpeg settings and change the FFMPEG Executable Path to: "; cat /etc/passwd && echo 'poc'"

3. click on update

4. now visit http://localhost/#!/version or click on version and you should see the content of /etc/passwd


dizqueTV 1.5.3 — Remote Code Execution (RCE): Overview, Impact, and Mitigation

dizqueTV is an open‑source web interface for running and managing media streaming tools such as ffmpeg. In version 1.5.3 a vulnerability permitted an attacker with access to the administrative UI to cause arbitrary command execution on the host process that runs the dizqueTV backend. This article explains the technical root cause in general terms, the likely impact, how to detect exploitation, and practical mitigation and secure‑coding recommendations for developers and administrators.

Executive summary

  • The issue stems from the application using untrusted input (a configured FFMPEG executable path) in a shell context without adequate validation or escaping.
  • An attacker who can modify that configuration (e.g., via the admin UI or API) could cause the server to evaluate unintended shell constructs and run arbitrary commands.
  • Impact ranges from data exposure and privilege escalation to full host compromise depending on the process privileges.
  • Mitigations: upgrade to a patched release (check the vendor/maintainer), restrict access to admin interfaces, use safe process invocation APIs, validate/whitelist inputs, run services with least privilege, and add detection controls.

Technical root cause (high level)

At a conceptual level the vulnerability is a command‑injection flaw: a configuration field intended to contain a path to an executable was treated as data but later passed into a shell invocation in a way that allowed special characters and shell metacharacters to be interpreted. When user‑controlled strings are interpolated into shell commands, an attacker can append extra shell constructs that the shell will execute.

Important defensive takeaway: never pass raw, user‑controlled strings to a system shell. Prefer invoking binaries directly using argument arrays and avoid shell interpretation entirely.

Impact and risk scenarios

  • Local data leakage: attacker can read files accessible to the dizqueTV process.
  • Privilege escalation: if the service runs as root or a privileged user, attacker can perform system‑level changes.
  • Persistent compromise: ability to install backdoors, modify startup scripts, or create user accounts.
  • Supply chain / lateral movement: access to credentials, tokens, or network access to pivot to other systems.

Detection and indicators of compromise (IoCs)

  • Unexpected modifications to configuration entries (ffmpeg path settings) via the web UI or API.
  • Suspicious shell activity spawned by the dizqueTV process (new processes like sh, bash, curl, wget running as that user).
  • Unusual network connections or outbound traffic originating from the host at times when no administrative changes occurred.
  • Audit logs showing access to version or status endpoints immediately after configuration updates.

Immediate mitigation steps for administrators

  • Restrict access to the administrative UI to trusted networks and VPNs; block external access to management endpoints.
  • Apply vendor patches or upgrades as soon as they are available. If a fixed release is announced, upgrade to the latest secure version.
  • Restart the service after patching and review recently changed configuration values for tampering.
  • Run the dizqueTV process with a non‑privileged account and minimal filesystem permissions to limit blast radius.
  • Inspect logs and the filesystem for signs of exploitation; rotate credentials and secrets that were accessible to the service.

Longer‑term hardening and secure development guidance

Developers and operators should apply defense‑in‑depth: input validation, safe process execution, access controls, and runtime monitoring.

  • Whitelist and validate configuration values: Only allow executable paths that match a known good set or reside under expected directories. Reject or normalize unexpected characters.
  • Avoid shell invocation: When launching external programs use APIs that accept argument arrays (no shell parsing) and avoid building a single string command.
  • Use explicit executable resolution: Resolve and verify the absolute path to binaries rather than trusting user input verbatim.
  • Least privilege: Run processes in a dedicated user account or container, with restrictive file and network permissions.
  • Sanitize admin inputs and implement RBAC: Ensure only authorized users can change sensitive settings.

Safe code patterns — examples and explanations

The example below demonstrates safe process invocation in Node.js using child_process.spawn with an argument array, plus a simple whitelist check for allowed ffmpeg paths. This is defensive code: it avoids passing a command string to a shell and verifies inputs before use.

const { spawn } = require('child_process');
const path = require('path');

const ALLOWED_FFMPEG_PATHS = [
  '/usr/bin/ffmpeg',
  '/usr/local/bin/ffmpeg'
];

// simple function to check that configured path is in whitelist and is absolute
function validateFfmpegPath(cfgPath) {
  if (!cfgPath || typeof cfgPath !== 'string') return false;
  const abs = path.resolve(cfgPath);
  return ALLOWED_FFMPEG_PATHS.includes(abs);
}

// Example: invoke ffmpeg with argument array (no shell)
function runFfmpeg(ffmpegPath, args) {
  if (!validateFfmpegPath(ffmpegPath)) {
    throw new Error('Invalid ffmpeg path');
  }

  // spawn with an array of args; do not use { shell: true }
  const child = spawn(ffmpegPath, args, {
    stdio: ['ignore', 'pipe', 'pipe'],
    env: process.env
  });

  return child;
}

Explanation: validateFfmpegPath enforces a whitelist of known executable paths. runFfmpeg calls spawn with an array of arguments and no shell enabled, so there is no shell interpolation of metacharacters. This prevents command injection via the executable path or arguments.

Other useful techniques: use a strict file permissions model (e.g., chroot or containers), perform file existence and executable bit checks, and use OS‑level mechanisms (AppArmor, SELinux) to restrict behavior.

Monitoring and detection examples

  • Set alerts for process spawn trees where the dizqueTV service starts a shell (sh, bash) unexpectedly.
  • Monitor configuration change events (UI/API) and require multi‑factor admin authentication for sensitive changes.
  • Use integrity checks (tripwire, checksums) on critical configuration and binary files.

Responsible disclosure and testing guidance

If you discover a vulnerability in an open‑source project, follow responsible disclosure practices: privately report the issue to the project maintainers or security contact, allow time for a fix, and coordinate public disclosure. Do not exploit or demonstrate working payloads on production systems or systems you do not own.

For testing, use isolated lab environments or containers that are air‑gapped from production and do not contain sensitive data.

Summary checklist for operators

  • Check whether your deployment uses dizqueTV 1.5.3; if so, prioritize applying a vendor patch or upgrade.
  • Restrict admin UI access and enforce strong authentication and RBAC.
  • Run the service as an unprivileged user and restrict filesystem access.
  • Audit configurations and logs for suspicious changes or unexpected process activity.
  • Adopt safe coding patterns (no shell interpolation of user input) and whitelist executable paths.
Aspect Recommended action
Immediate Restrict admin access, inspect configs, upgrade when patch available
Medium term Run as non‑privileged user, add monitoring and file integrity checks
Developer fixes Whitelist executables, avoid shell usage, validate inputs

For the most accurate remediation steps and patched version numbers, consult the upstream dizqueTV repository and security advisories from the project maintainers. If you need assistance auditing a deployment or implementing mitigations, consider engaging a qualified security consultant who can perform a safe, authorized assessment.