Security researchers from the company Parameter have identified a serious vulnerability in the popular ChatGPT service operated by OpenAI. By using a link to a shared conversation, it was possible to execute malicious JavaScript code directly in the context of a logged-in user's session. No additional interaction or malware installation was required; simply clicking the potentially malicious link was sufficient.
The attack relied on executing malicious JavaScript code inside the user's browser. Opening a shared conversation link was all that was needed to trigger the exploit. Consequences ranged from exfiltration of private conversations to complete account takeover. OpenAI confirmed the vulnerability and deployed appropriate fixes. Researchers received a $5000 reward through the Bug Bounty program.
How the attack worked
Individual system components functioned correctly and securely on their own. Only their combination created an opportunity for an attacker to smuggle and execute JavaScript code on the user side. ChatGPT allows rendering of HTML blocks generated by the language model as small subpages via the Preview feature. Due to security policies, OpenAI runs this content in an isolated environment on a separate domain, preventing direct access to the main chat window.
However, the same conversation also contained an interactive chart generated with the MathLive mathematical library. This component used an on-screen keyboard that could send messages to the main chat window via the postMessage mechanism. Commands sent through postMessage were not validated in any way. MathLive did not check the sender (event.origin, event.source) or the message contents.
This allowed raw HTML code to be sent in the keyboard layout configuration field (update-setting). The Preview component then forwarded the received code directly to the main application window without warnings. To execute arbitrary JavaScript, the Content Security Policy had to be bypassed. Inline scripts were blocked, but the policy permitted loading scripts from the YouTube domain. Researchers used an oembed callback to force the browser to load malicious code under the guise of a trusted YouTube script.
With the injected script, an attacker could operate within the context of the logged-in user's session, access conversation contents, open private chats, and exfiltrate data to an external server. Researchers demonstrated proof-of-concept leakage of a private chat. Although further exploitation was halted after demonstrating arbitrary JavaScript execution, the flaw effectively enabled full account takeover.
After receiving the report, OpenAI confirmed the vulnerability, classified it as P1 severity, and deployed fixes within eight days. The $5000 Bug Bounty reward was paid, and engineers responded professionally throughout the process. No user-side actions are required as patches were applied on the provider's servers.

