GitHub Security Advisory: GHSA-2f9h-23f7-8gcx
Package: wwbn/avideo (COMPOSER)
Severity: HIGH (CVSS 8.1)
CWE: CWE-306: Missing Authentication for Critical Function
Vulnerable versions: <= 25.0
Patched in: unpatched

Summary: AVideo affected by unauthenticated application takeover via exposed web installer on uninitialized deployments

Details:
## Summary
The `install/checkConfiguration.php` endpoint performs full application initialization — database setup, admin account creation, and configuration file write — from unauthenticated POST input. The only guard is checking whether `videos/configuration.php` already exists. On uninitialized deployments, any remote attacker can complete the installation with attacker-controlled credentials and an attacker-controlled database, gaining full administrative access.

## Affected Component
- `install/checkConfiguration.php` — entire file (lines 1-273)

## Description

### No authentication or access restriction on installer endpoint

The `checkConfiguration.php` file performs the most privileged operations in the application — creating the database schema, the admin account, and the configuration file — with no authentication, no setup token, no CSRF protection, and no IP restriction. The sole guard is a file-existence check:

```php
// install/checkConfiguration.php — lines 2-5
if (file_exists("../videos/configuration.php")) {
    error_log("Can not create configuration again: ".  json_encode($_SERVER));
    exit;
}
```

If `videos/configuration.php` does not exist (fresh deployment, container restart without persistent storage, re-deployment), the entire installer runs with attacker-controlled POST parameters.

### Attacker-controlled database host eliminates credential guessing

Unlike typical installer exposure vulnerabilities where the attacker must guess the target's database credentials, this endpoint allows the attacker to supply their own database host:

```php
// install/checkConfiguration.php — line 25
$mysqli = @new mysqli($_POST['databaseHost'], $_POST['databaseUser'], $_POST['databasePass'], "", $_POST['databasePort']);
```

The attacker can:
1. Run their own MySQL server with the AVideo schema pre-loaded
2. Set `databaseHost` to their server's IP
3. The connection succeeds (attacker controls the DB)
4. The configuration file is written pointing the application at the attacker's database permanently

### Admin account creation with unsanitized input

The admin user is created with direct POST parameter concatenation into SQL:

```php
// install/checkConfiguration.php — line 120
$sql = "INSERT INTO users (id, user, email, password, created, modified, isAdmin) VALUES (1, 'admin', '"
     . $_POST['contactEmail'] . "', '" . md5($_POST['systemAdminPass']) . "', now(), now(), true)";
```

This has two issues: (1) the attacker controls the admin password, and (2) `$_POST['contactEmail']` is directly concatenated into SQL without escaping (SQL injection).

### Configuration file written with attacker-controlled values

The configuration file is written to disk with all attacker-supplied values embedded:

```php
// install/checkConfiguration.php — lines 238-247
$videosDir = $_POST['systemRootPath'].'videos/';

if(!is_dir($videosDir)){
    mkdir($videosDir, 0777, true);
}

$fp = fopen("{$videosDir}configuration.php", "wb");
fwrite($fp, $cont