AIDEFEND in Action AIA-0185 Validated Research

ChatGPT Plugins: Three OAuth Flaws Let Attackers Install Their Own Plugin or Take Over Plugin Accounts

ChatGPT's former plugins used OAuth to connect a user to an outside service. Salt Labs found three separate flaws: the platform could accept an installation the user had not started, an external service could issue a sign-in code for another account, and another could send that code to the wrong website. The reported flaws were fixed before publication and the plugin feature was retired in April 2024.

Authentication BypassCredential TheftIdentity & AccessAI CopilotsSaaS Security
3 applicable AIDEFEND defenses

Threat Analysis

  • What plugins were, and which flow Salt examined. ChatGPT plugins, launched in 2023 and wound down in spring 2024, let ChatGPT call third-party web services described by a manifest and an API specification. Many plugins acted on the user's own account at that service, so installing one ran an OAuth sign-in: the user approved access on the plugin's site, the site returned an authorization code (a one-time credential that is exchanged for an access token) to ChatGPT, and ChatGPT used it to connect the plugin to that account. In July 2023, Salt Labs researcher Aviad Carmel examined this flow and found one flaw in each of three different components. They are three independent attack paths, not steps of one chain.
  • Path A: a link installs the attacker's plugin. ChatGPT installed a plugin as soon as it received a code at its plugin callback, without checking that the user had started that installation. It did send a state value, the OAuth parameter meant to tie a callback to the user's own request, but Salt found the value was not random and could be guessed. An attacker could write a plugin that tells ChatGPT to forward almost any chat content to it, obtain a code for that plugin tied to his own account, and send the victim a link on the real ChatGPT domain. Opening it installed the plugin in the victim's account, bound to the attacker's credentials, with no confirmation. Salt says any later message the victim writes may then reach the plugin, including credentials or passwords.
  • Path B: a code for any member, with no click. PluginLab.AI was a framework developers used to build ChatGPT plugins, including AskTheCode, ScholarAI, ChatOCR, KeyMateAI, ShowNotes and Perfect Chirp, and it handled their user accounts and sign-in. AskTheCode lets users ask questions about their GitHub repositories and asks for access to the user's GitHub account. PluginLab's authorization endpoint returned a code for whichever member ID the request named without authenticating who was asking, and the member ID could be derived from the user's email address. With a victim's code, the attacker finished installing AskTheCode in his own ChatGPT, which connected it to the victim's AskTheCode account. Salt publishes a screenshot taken from the attacker account reading a private file from a victim's GitHub. The victim did nothing; Salt calls it zero-click.
  • Path C: the code goes wherever the link says. Installing Charts by Kesem AI started a sign-in at Kesem.ai that ended by sending the code to the link's redirect_uri. Kesem.ai did not validate that address, so a victim who clicked an attacker's sign-in link sent their own code to the attacker's site, and the attacker could use it to take over the victim's account on the plugin, as in path B. Salt also found plugins that checked only the domain of redirect_uri; pointing the path at the attacker's own plugin on the same domain was still enough to capture the code.
  • What the evidence shows. This is responsible-disclosure research. Salt reported the ChatGPT flaw to OpenAI on 10 July 2023 and the PluginLab and Kesem flaws in September 2023; all were fixed before Salt shared its write-up with the vendors on 27 February 2024 and published it on 13 March 2024. PluginLab told Salt that its investigation found no user data compromised, and there is currently no public evidence that any of the three paths was used in a real attack. Salt's write-up cites no CVE (public vulnerability identifier); all three flaws were in online services that their operators ran and fixed. According to OpenAI's help article as quoted on OpenAI's developer forum, new plugin installs and plugin conversations stopped on 19 March 2024, and existing plugin conversations could not continue after 9 April 2024.
  • Why this still applies. Today's ways of connecting AI assistants to other services, such as custom GPT actions (which let a GPT call an external API), connectors (which let ChatGPT reach data in services such as Google Drive) and MCP servers (services that provide tools to AI assistants over the Model Context Protocol), often use OAuth too, and they rely on the same three checks: the AI client must confirm that the user started each authorization, the authorization service must issue a code only for the account that actually signed in, and the code may go only to the exact registered address. Salt notes that GPTs warn users when data is sent to a third party, while saying this does not solve the problem entirely. The research does not show that any current product has these flaws; it shows what breaks when one of these checks is missing.

Applicable AIDEFEND Defenses (3)

AID-E-001.002
Issued Token, Authentication Session & Lease Revocation
High
Fixing the authorization endpoint stops new codes, but an attacker who already redeemed a victim's code keeps whatever access or refresh token the plugin service issued for it. The operator of the integration's authorization service should revoke every token and session issued through the flawed endpoint during the exposure window, or all of them when issuance cannot be tied to a genuine sign-in, then confirm with a retained test token that the API refuses it, and have users reconnect. Revocation ends continued access; it does not recover repository contents or account data already read.
AID-E-001.004
Delegated Grant & Connected-App Authorization Revocation
High
In path B the attacker never held a GitHub credential; he reached the repositories through the access the victim had granted AskTheCode on GitHub. Revoking that authorization in the victim's GitHub settings, or by an organization owner for organization repositories, cuts off repository reads for anyone holding a session to the victim's plugin account, including sessions the plugin operator has not yet found. Afterwards, confirm that the integration is gone from the authorized applications list and that a repository request through the plugin fails. It does not undo reads that already happened, and it also stops the victim's own use until they authorize again.
AID-E-005
Compromised Durable Application Session & Agent State Teardown
High
Once the forged installation is found, removing the attacker-bound plugin from the victim's account stops further messages from being sent to it. The account holder or workspace administrator removes that exact tool registration, or the platform operator sweeps all accounts, then confirms it is gone from the installed-tools list and that a new conversation neither offers nor calls it. Finding it requires a list that shows each installed tool and, ideally, which external account it is linked to. Messages already forwarded stay with the attacker, and passwords or credentials typed into them have to be changed separately.

What Defenders Should Do Now

  • If you build an AI client that connects tools through OAuth, refuse callbacks the user did not start. In a test environment, start an authorization as test user A, then open the resulting callback link in test user B's session. It passes only if the callback is refused and no tool or connector appears in B's account. Also confirm that every flow uses a fresh random state that works once, together with PKCE (S256).
  • If you run the sign-in for a GPT action backend, connector or MCP server, test redirects and identity. Send authorization requests whose redirect_uri differs from the registered value by host, by path, or by one extra path segment; each must be refused before any code is issued. Then, signed in as one test account, request a code that names another account's identifier; the request must fail. The identifier in a request must never decide whose code is issued.
  • Review what is connected, on both sides. In each AI assistant your organization uses, list the installed tools, apps or connectors and the external account each one is linked to, and remove any that nobody recognizes. In GitHub and similar services, review which third-party apps are authorized to reach your repositories and revoke those no longer needed.
  • If a forged connection or a flawed authorization endpoint is found, revoke first, then verify. The service operator revokes tokens and sessions issued through the flawed endpoint during the exposure window and confirms that a retained old token is refused. Affected users revoke the integration's access in GitHub or the other service, remove the unexpected tool from their assistant, change any password they typed into chats, and reconnect only after the fix is confirmed.

1 additional consideration

Organization approval before AI apps reach organization repositories

In path B the plugin read repositories through access that one user had granted. On GitHub, organization owners decide whether such a grant can reach the organization's repositories at all.
Recommendation: Organization owners can turn on OAuth app access restrictions, so that a third-party OAuth app a member authorizes reaches organization repositories only after an owner approves it, and review the approved list periodically. An AI tool a member connects on their own then cannot reach organization code without review. This does not stop a takeover of an approved tool, which can still read everything it was granted.

Conclusion

The AI platform should verify who started a connection. The external service should issue a code for the signed-in account and send it only to the registered address. AIDEFEND  maps the response: remove the unwanted plugin and revoke its tokens and downstream access.

Last updated: