Summary
AutoGPT versions 0.6.36 through 0.6.50 contain an authenticated session hijacking vulnerability caused by missing authorization checks on the session reassignment endpoint.
Any logged-in user who can guess or obtain another user's session_id can reassign that session to themselves, read its messages, and lock the original owner out.
Affected context
This vulnerability appears in AutoGPT's workflow automation platform where user sessions represent conversational or automation context.
The affected behavior centers on the PATCH /sessions/{session_id}/assign-user endpoint, which updates the owner of an existing session.
In the vulnerable versions, the endpoint performs authentication but does not confirm that the caller actually owns the target session, and the service layer passes user_id=None into the data access layer.
That None value is interpreted as a privileged/system lookup that bypasses ownership filtering, effectively granting broad access to any session identifier that an authenticated user can target.
Exploit preconditions
- Attack surface: HTTP API endpoint
PATCH /sessions/{session_id}/assign-userexposed to authenticated users. - Required access: Attacker must be an authenticated AutoGPT user with normal account privileges.
- Knowledge required: Ability to obtain, predict, or enumerate a valid
session_idfor another user's session (through logging, side channels, or weak ID properties). - Trigger point: Sending a request to the assign-user endpoint with the victim's
session_id, causing the backend to reassign that session to the attacker's account. - Why exploitation is possible: The service layer calls the data access layer with
user_id=None, which is treated as a privileged/system context and bypasses ownership checks, so no per-session authorization validation occurs.
Why this happens
The root cause is a broken access control pattern in the session assignment logic, mapping to CWE-862: Missing Authorization.
While the API enforces that the caller is authenticated, it fails to enforce that the caller is authorized to modify the specific session resource referenced by session_id.
The design of the service and data access layers uses user_id=None as a special, privileged mode that returns sessions without filtering by owner.
By invoking session lookup with user_id=None for regular user requests, the code effectively implements an Insecure Direct Object Reference (IDOR): authorization is not re-checked on the specific object being manipulated.
Abstractly, the insecure pattern is: authenticate once at the endpoint, then perform object lookup or mutation in a context that bypasses per-object authorization constraints.
Potential impact
- An authenticated user could hijack another user's active or historical sessions by reassigning ownership.
- Attackers may read all messages and data associated with a victim's session, including potentially sensitive or proprietary information.
- Victims can be locked out of their own sessions once reassigned, disrupting their workflows or investigations.
- Compromised sessions could be used to manipulate or misconfigure automation workflows, leading to unintended actions or downstream data changes.
- Repeated exploitation could undermine tenant isolation expectations and damage trust in the platform's security model.
General mitigation guidance
Effective mitigation focuses on enforcing strict, per-resource authorization and avoiding ambiguous "privileged" call paths in shared data access utilities.
Recommended defensive patterns include:
- Enforce ownership checks at the service layer: For every operation that targets a session by
session_id, verify that the current authenticated user is the owner (or is explicitly authorized) before allowing reassignment or access. - Avoid implicit privileged modes: Remove or constrain patterns where
user_id=Noneor similar sentinel values trigger bypasses in the data access layer; privileged operations should use clearly separate code paths or roles. - Apply least privilege to API endpoints: Design endpoints such that they act only on resources naturally scoped to the current user (e.g., deriving session lists from the authenticated user context rather than arbitrary IDs).
- Centralize authorization logic: Implement a reusable authorization checker or policy layer that evaluates resource ownership and roles consistently, rather than scattering ad-hoc checks across endpoints.
- Harden identifier handling: Use session identifiers that are unguessable (e.g., cryptographically strong random IDs) and avoid exposing them unnecessarily in logs or URLs visible across tenants.
- Defense-in-depth validation: Even after the primary fix, consider checking both at the service level and data access level that operations on sessions are constrained to the requesting user unless a well-defined admin capability is explicitly in use.
How teams detect issues like this
Detection for this type of vulnerability and abuse typically combines code-level analysis with runtime monitoring:
- Static code review patterns:
- Search for endpoints that accept direct resource identifiers (e.g.,
session_id) and mutate ownership or access without explicit authorization checks. - Flag data access calls that use sentinel values (such as
user_id=None) to bypass filters, especially when invoked from user-facing API handlers. - Review service methods that change resource ownership or sharing permissions to ensure they always validate tenant boundaries and roles.
- Static and SAST tools:
- Configure static analysis tools to detect missing authorization checks on routes annotated as "authenticated".
- Add custom rules that alert when object lookups for multi-tenant resources omit a current-user or tenant constraint.
- Runtime and log-based detection:
- Monitor logs for patterns where a single user repeatedly calls session assignment endpoints targeting many different
session_idvalues. - Alert on sudden changes in session ownership, especially across distinct user accounts or tenants.
- Track anomalies where a session's ownership changes without corresponding administrative activity.
- Policy enforcement in CI/CD:
- Require security reviews or automated checks for all new or modified endpoints that allow cross-user resource operations, such as reassigning ownership or transferring data.

