Skip to main content
Menu
Advisories

[Security] AG2 Network Hub does not bind post-admission control operations to the authenticated connection identity

GHSA-3CCW-G7PH-HRCRPublished Updated GitHub

Description

Maintainer summary

Affected: the AG2 Network Hub served over the wire (serve_ws / cross-process control plane), ag2 >= 0.13.3, < 1.1.2 (and the autogen mirror >= 0.13.3, <= 0.14.1). In-process hubs with no wire transport are not affected.

Impact: after admission, the hub trusted identity fields in client requests instead of the connection's authenticated identity. A client holding valid credentials only for its own agent (or, in some cases, none) could act as any other agent, read other agents' messages and private state, and forge audit/telemetry records. The most severe variant: get_agent / list_agents returned every agent's auth.claim (for ApiKeyAuth, the raw API key), so any client could obtain another agent's key and fully re-attach as that agent.

Fix: every wire request is now authorized against the agents bound to the calling connection (registered on it, or re-attached with an authenticated HelloFrame in the identity's registered scheme); credentials are never returned or persisted; see the scenarios below. Upgrade to ag2 1.1.2 or later. The fix is included in v1.1.2.

Workarounds (until upgraded): do not expose the hub over the network to untrusted clients; run it only on a trusted network segment; use a registry without NoAuth; rotate API keys of agents on hubs that were reachable by untrusted clients.

Scenarios fixed

Unless noted, over the wire with ApiKeyAuth, the attacker holding only its own key.

#ScenarioBefore → after
1Acting as another agent through control-plane ops (set_skill / set_resume / set_rule / unregister / create_channel / pending_turns_for / report_turn_failure / record_observation / can_send)accepted for any agent_id → access_denied unless that agent is bound to the connection
2Reading or closing a channel you're not in (read_wal, get_channel, close_channel, find_envelope_by_causation); list_channels() listing every channelfull WAL, including direct messages → access_denied; list_channels() lists only the connection's own channels
3Credential disclosure: get_agent / list_agents / register returned auth.claim, and the claim was persisted to the store. Also present on main.raw API keys returned and kept on disk → never returned; dropped after registration; hydrate scrubs older stores
4HelloFrame re-attach using a client-chosen scheme (auth_scheme="none" in a registry that also holds NoAuth)re-attach as any agent → refused unless the scheme is the identity's registered one; a non-object claim gets auth_failed
5remote_agent: registration without credentials, takeover via Hello, squatting an authenticatable name (e.g. carol)all accepted → wire registration off by default; when enabled it needs an owning agent on the connection, and Hello works only alongside an owner
6A name shadowing another agent's id (name = bob's agent_id)lookups by id routed to the impostor → id-shaped names refused; get_agent and workflow handoffs resolve exact ids first
7Non-participants posting into a channel: non-text content the adapter accepted, protocol events, invite.reject closing a pending channelaccepted, stored and dispatched → ProtocolError from a hub-level participant check
8Clients forging hub-only channel events (opened / closed / expired / invite), e.g. a fake closed ending delegate waitsaccepted → only invite.ack / invite.reject accepted from clients
9Cancel-request abuse: content injection, broadcast, arbitrary audience, posting into pending channels, flooding (bypasses the inbox cap), hub stall from a WAL scan per requestany event type-checked only → tool-shaped only (live observed task in the same active channel, audience == [owner], exact {task_id, reason: str}), one per sender per task, tracked in memory under the WAL lock
10observe_task attaching a task to a channel the owner isn't inaccepted → access_denied
11Reading or overwriting another agent's checkpoint; observe_task taking over a checkpointed idaccepted → owner-only for observed tasks; the first wire writer owns unobserved ids; observe_task respects the writer
12Forged task events in audit and telemetry (fire_task_event for any id, any owner_id / channel_id, terminal kinds), including from a connection with no agentforged task_terminated records and spans → only TaskMirror's mirror_failed with its exact payload, with owner and channel checked
13record_observation dedup poisoning (reporting a task id first)the owner's observation silently dropped → dedup keyed on (owner_id, task_id)
14Delivery receipts for another agentadvanced its cursor → dropped unless the recipient is bound
15task_id path traversal (checkpoint_task("../agents/x"))wrote outside tasks/ → ProtocolError; wire task ids must match [A-Za-z0-9][A-Za-z0-9._-]{0,127}
16Malformed frames (list name / recipient_id, int since_envelope_id)connection dropped → ErrorFrame(protocol_error), connection stays open

---

Original report

Summary

I am privately reporting an authorization issue in the ag2.network Hub WebSocket control plane.

Verified main revision: f7d426b522b6d559c781217a9b7b3ab3e603bccc Verified affected release: v1.0.5 Affected package: ag2

The Hub authenticates a client at connection admission, but post-admission control-plane operations do not consistently bind the requested agent_id, sender_id, channel_id, or task owner to the identity associated with that authenticated connection.

At registration, the Hub creates an endpoint-to-agent binding with bind_endpoint(...). After that point, however, _dispatch_request_op(endpoint, op, params) accepts operation parameters from the client and forwards them to Hub methods without checking whether the supplied identity belongs to the calling endpoint.

This creates an authorization gap between:

  • who authenticated / which agent is bound to the connection, and
  • which agent or channel the caller is allowed to operate on after admission.

The attached PoC demonstrates the issue with a valid low-privileged API key in the documented ApiKeyAuth deployment posture. A client authenticated only as its own participant can:

  • read the full WAL of a channel it never joined, including an audience-restricted direct message;
  • submit an envelope while claiming another agent's sender_id; and
  • overwrite another agent's persisted skill state.

The source-level control surface shows the same missing connection-identity binding across additional post-admission operations such as set_resume, set_rule, unregister, update_task, and record_observation.

The default NoAuth configuration removes even the admission credential requirement, but I treat that as a secondary deployment variant rather than the primary severity case.

Root cause

Authentication is performed at admission

ApiKeyAuth validates a token for a claimed agent identity during the connection handshake, and the Hub binds the endpoint to that registered identity with bind_endpoint(...).

That creates the security-relevant connection identity.

Post-admission requests trust client-supplied identities

The wire control plane is dispatched through:

Hub._dispatch_request_op(endpoint, op, params)

The endpoint is used in the registration branch when the connection is bound to the newly registered identity. Subsequent branches use identities supplied directly in request parameters.

Examples include:

  • set_resume(params["agent_id"], ...)
  • set_skill(params["agent_id"], ...)
  • set_rule(params["agent_id"], ...)
  • unregister(params["agent_id"])
  • post_envelope(Envelope.from_dict(params["envelope"]))
  • read_wal(params["channel_id"], ...)
  • pending_turns_for(params["agent_id"])
  • update_task(params["task_id"], ...)
  • record_observation(owner_id=params["owner_id"], ...)

I did not identify a check that the requested identity is owned by, or authorized for, the calling endpoint.

Sender validation checks registration, not connection ownership

On the message path, _post_envelope_impl(...) resolves the claimed sender with:

sender = self._passports.get(envelope.sender_id)

and rejects the request if that sender is not registered.

That verifies that the claimed identity exists, but not that the caller is the endpoint bound to that identity. Downstream participant/role checks therefore operate on a client-asserted sender_id.

read_wal has no caller identity or visibility filter

read_wal(channel_id, since, until) reads and returns the stored envelopes for the supplied channel. It has no caller-identity argument and does not apply participation or envelope-visibility filtering before returning the WAL.

The default registry is NoAuth

The source documents NoAuth as:

No-op adapter — accepts every claim. Default registry entry.

The distributed-deployment documentation likewise states that the default is NoAuth and recommends ApiKeyAuth for deployed systems.

The primary PoC uses ApiKeyAuth specifically to demonstrate that the defect is not merely a consequence of the no-auth default.

Executed proof of concept

The reproduction was executed locally against the public repository using the documented WebSocket Hub deployment pattern.

The primary environment uses:

  • serve_ws(hub, "0.0.0.0", 8765);
  • AuthRegistry([ApiKeyAuth(...)]);
  • three synthetic agents: Alice, Bob, and Mallory;
  • valid API keys for all three; and
  • Mallory possessing only Mallory's own valid API key.

The attacker side uses raw WebSocket protocol frames rather than the AG2 client library.

The behavior was reproduced in the original run and in two independent verification reruns in fresh containers.

Baseline — Mallory registers only as herself

Mallory authenticates and registers legitimately using only Mallory's own API key.

Defect 1 — cross-channel WAL read

Mallory requests read_wal for the Alice/Bob conversation channel even though Mallory is not a participant.

The Hub returns the channel WAL, including an envelope addressed specifically to Bob. The PoC uses a synthetic restricted-message marker to demonstrate that addressed content is returned to the unrelated authenticated participant.

Negative control — participant gate works for Mallory's real identity

Mallory attempts to post into the protected conversation using Mallory's actual sender_id.

The conversation participant check rejects the send.

This confirms that a participant gate exists and is active.

Defect 2 — spoofed sender bypasses that gate

Mallory sends the same class of request while setting the envelope sender_id to Bob's registered agent ID.

The Hub accepts the envelope and mints an envelope ID.

The downstream participant gate therefore trusts the claimed sender identity rather than the connection-bound identity.

Defect 3 — cross-agent persisted state modification

Mallory calls set_skill with Bob's agent_id.

Bob's persisted skill content is overwritten, and a subsequent read returns the modified value.

This demonstrates cross-agent integrity impact on persisted behavior state.

The report also documents additional source-level operations that appear to share the same missing endpoint/identity authorization binding (set_resume, set_rule, unregister, update_task, and record_observation). Those source-supported surfaces are distinguished from the operations directly exercised in the PoC.

Impact

In the documented authenticated deployment posture, any authenticated participant or compromised agent process can exercise control-plane authority over identities and channels that do not belong to that connection.

The directly demonstrated impact includes:

  • Confidentiality: reading the WAL of an unrelated channel, including audience-restricted content.
  • Integrity: sending an envelope as another registered agent and overwriting another agent's persisted skill state.

The exposed control surface also contains operations whose unauthorized use can affect task state and agent availability.

This report does not claim:

  • remote code execution;
  • compromise of API-key secrets;
  • bypass of ApiKeyAuth token validation at admission; or
  • end-to-end takeover of every AG2 deployment.

The defect is the missing authorization binding after a connection has already been admitted.

Preconditions

For the primary authenticated scenario, the attacker needs:

  • network access to the Hub WebSocket endpoint; and
  • any valid participant credential accepted by the Hub.

The attacker does not need another agent's API key.

The default AuthRegistry contains only NoAuth, which accepts every claim. In a network-reachable deployment using that default, the credential prerequisite is removed. I treat this as a secondary deployment variant because the deployment guidance recommends ApiKeyAuth.

Provisional severity

Primary authenticated-participant scenario:

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

8.8 (High)

The earlier draft's 8.0 score for this vector was incorrect.

Documented default NoAuth variant:

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

9.8 (Critical)

I am using High / 8.8 as the primary submission severity and defer final scoring to the maintainers.

Weakness classification

Preferred:

CWE-862 — Missing Authorization

Secondary:

CWE-284 — Improper Access Control

Additional mechanism-specific classification:

CWE-345 — Insufficient Verification of Data Authenticity

The core problem is not authentication failure at admission; it is missing authorization that binds later operations to the authenticated connection identity.

Security-model notes

The distributed deployment documentation describes authentication as validating the claim before binding the connection. That admission model requires later operations to be authorized against the resulting endpoint/identity binding.

The documented expectations/audit hook layer does not close the demonstrated gap: hooks operate on the identity present in the request/envelope, authorize_register is documented as reserved/not yet wired, and there is no equivalent hook for several of the affected control-plane operations.

The read_wal documentation describes reading WAL data for channels a process "can see", but I did not identify a server-side permission model that enforces that phrase on the wire read_wal operation.

Relation to public neighboring issues

Public sender-identity and transport-security discussions exist in the broader AutoGen ecosystem, but they concern different repositories and runtimes.

This report concerns the ag2.network Hub control plane in ag2ai/ag2, specifically the missing post-admission binding between the WebSocket endpoint and the identities supplied in control-plane operations.

I did not identify a public advisory for this AG2 Network Hub mechanism at the time of verification.

Suggested remediation

Bind every post-admission control operation to the authenticated connection identity.

Possible steps include:

  1. derive the caller's authorized agent identity set from the endpoint binding created at admission;
  2. reject any agent_id, sender_id, owner_id, or equivalent identity outside that authorized set;
  3. for post_envelope, overwrite or validate sender_id against the endpoint-bound identity rather than trusting the envelope;
  4. authorize read_wal based on channel participation or an explicit operator/audit role and apply visibility rules before returning stored envelopes;
  5. authorize set_skill, set_rule, set_resume, unregister, task mutation, and observation operations against ownership or an explicit administrative role;
  6. treat the Hello reconnect/name-claim path as re-authentication of the claimed identity; and
  7. add regression tests proving that a client authenticated as Mallory cannot read Alice/Bob-only channel data, send as Bob, or mutate Bob's persisted state.

Affected versions

The behavior is verified in:

  • public release v1.0.5; and
  • main commit f7d426b522b6d559c781217a9b7b3ab3e603bccc.

The relevant authentication, endpoint binding, request dispatch, sender lookup, and unrestricted WAL-read paths are present in v1.0.5.

The AG2 Network module predates this release, but I have not exhaustively established the first affected package version. I therefore defer the complete affected range to the maintainers.

Attachment

ASTS-C26_Ag2HubIdentity_disclosure_bundle.zip

The final bundle should contain the reproduction instructions, original PoC evidence, two independent reruns, environment details.

All testing was performed locally against the public repository using synthetic agents, channels, messages, and credentials.

This issue has not been publicly disclosed. I am happy to coordinate disclosure timing and to re-test a patched build.

Best regards, Darry Bugcrowd: @genforAI

Affected versions

References

GitHub · ag2ai/ag2