A security researcher has uncovered a serious vulnerability in the ChatGPT platform that allowed attackers to access user accounts, view private conversations, and extract data from them simply by opening a link to a shared conversation, without having to install any applications or enter login credentials.

Security researcher Mukul Goyal explained in a report that the vulnerability allowed attackers to create a malicious conversation on ChatGPT and share it using the conversation-sharing feature available to all users. Opening the link would then trigger malicious code within the victim's account, granting the attacker access to their data and allowing them to act on their behalf.

Goyal said that during testing, his team managed to access a user's private conversation list and read the contents of a conversation that the account owner had never shared with anyone. The researchers then sent part of its data to an external server belonging to the research team.

The vulnerability was not limited to viewing conversations. The code the researchers managed to execute had the same permissions used by ChatGPT to interact with the logged-in account, theoretically allowing other actions to be carried out on the user's behalf.

The attack relied on exploiting ChatGPT's conversation-sharing feature, which allows users to generate a public link to a conversation so that anyone with the link can view its contents. An attacker could prepare a conversation containing malicious code and then send its link to a victim via email, messaging applications, or social media posts.

Once the victim opened the link while logged into their account, the malicious elements would begin operating, exploiting the vulnerability to execute code with the same permissions as the account.

The attack did not require the victim to install any application, join a shared project on the platform, or copy and run any code. It also did not require the use of developer tools in the internet browser.

The researchers tested the attack three times using a separate account and managed to reproduce it even after fully reloading the ChatGPT page. The malicious code began executing approximately 4.5 seconds after the link was opened.

𝗕𝘆𝗽𝗮𝘀𝘀𝗶𝗻𝗴 𝗜𝘀𝗼𝗹𝗮𝘁𝗶𝗼𝗻 𝗮𝗻𝗱 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆 𝗠𝗲𝗮𝘀𝘂𝗿𝗲𝘀

According to the report, the vulnerability was discovered while the researchers were testing the security mechanism ChatGPT uses when displaying web pages within conversations.

The platform allows users to create web pages using HTML code and then preview and run them directly through its Preview feature. These pages are isolated in an environment separate from the main website to prevent their embedded code from accessing account data or controlling the ChatGPT page.

The researcher confirmed that the isolation system was functioning correctly, and that code inside the preview window could not directly read the contents of the main page. However, the team discovered a way to bypass this isolation by exploiting the interactive charts feature.

ChatGPT uses a software library to exchange messages between different components of a web page, allowing control over keyboard settings, including changes to its layout and the elements displayed on it.

The researchers discovered that the library accepted certain messages without adequately verifying their source. This allowed code inside the isolated preview page to send commands to the library operating within the main ChatGPT page.

The team exploited this capability to send instructions that changed the virtual keyboard's layout, inserted HTML content under the researchers' control, and then issued a command to display the keyboard. This caused the content to appear inside the platform's main page.

However, inserting content into the ChatGPT page was not enough to carry out the attack, as the researchers encountered an additional security layer designed to prevent the execution of certain unauthorized code.

This layer relies on a security policy known as Content Security Policy (CSP), which specifies the sources from which a website is allowed to load and execute code.

The report explained that this policy blocked the direct execution of the code the team attempted to insert, but allowed program content to be loaded from YouTube. This led the researchers to look for a way to exploit one of the permitted content sources.

𝗘𝘅𝗽𝗹𝗼𝗶𝘁𝗶𝗻𝗴 𝗮 𝗬𝗼𝘂𝗧𝘂𝗯𝗲 𝗦𝗲𝗿𝘃𝗶𝗰𝗲

The team discovered that YouTube's oEmbed service could be exploited to obtain a response that allowed attacker-controlled code to be executed.

Although the service validated certain requests and rejected those that did not meet its requirements, it included part of the data supplied by the requester in its response before displaying an error message.

The researchers exploited this behavior to bypass restrictions on code execution, taking advantage of the fact that YouTube was among the sources permitted by the security settings of the ChatGPT page.

After successfully executing code with the website's permissions, the team tested whether it could access user data. Using the login session information available to the page, the researchers sent direct requests to ChatGPT's servers in the same way the platform does when displaying a conversation list or opening a previous conversation.

The researchers successfully retrieved a list of the latest conversations in the targeted user's account, then sent a request to access the contents of one private conversation and transmitted part of its data to an external server.

𝗢𝗽𝗲𝗻𝗔𝗜 𝗣𝗮𝘁𝗰𝗵𝗲𝘀 𝘁𝗵𝗲 𝗩𝘂𝗹𝗻𝗲𝗿𝗮𝗯𝗶𝗹𝗶𝘁𝘆

According to the report, OpenAI fixed the vulnerability on October 26, after its security team managed to reproduce the attack and confirm that private conversations could be accessed.

The company classified the vulnerability as P1, its first severity category in its security vulnerability reporting program.

The discovery highlights the importance of testing isolation mechanisms between components of digital platforms. It demonstrated that having separate layers of security does not necessarily prevent their connections from being exploited if the messages and data exchanged between them are not adequately verified.

𝗦𝗼𝘂𝗿𝗰𝗲: 𝗘𝗿𝗲𝗺 𝗡𝗲𝘄𝘀